Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminating perl script 2

Status
Not open for further replies.

Jaq

Programmer
Feb 17, 2001
8
US
Hopefully this will be a clearer version of the question I asked a couple of entries ago.Every perl program I write wants to open a window when it quits. I started with [print "Location: XXXX.html"; exit;], without the brackets, thats ok for some applications, it would of course bring up XXXX.html, but in some cases, for example cleaning up after the user has left the page, I dont want to generate any thing else. Ive tried just [exit;],and nothing, and [END;] etc...I always get a window with something or nothing in it, sent to the user that just logged out. Is there no way to run a perl cgi script without generating a window? Thanks Jaq@QB7.com
 
one way, i guess, would be to embed some javascript in the window that you open, to close the window.


just have it print something like


<script>
window.close();
</script>
 
Nope..putting a window close statement in the window brings up an alert thats says &quot;This window is trying to close itself. Do you want to close it?&quot;
 
i'm no javascript expert, but, i'm sure that there is a way to get rid of that....
 
I wish...That was one of the first possibilties I examined, every info source I can find says that the only window an existing window can close without user input and without the alert, is one it has also opened. Im new to perl, Im just a hobbyist programmer, but its hard for me to believe that perl is a language that must always open a window... Could it be true that every perl program ever written opens a window when it exits?
 
It isn't perl, it's the way the web works. Calling a cgi program is just like calling any other href in that it causes a &quot;new page&quot; to be loaded, whether that new page is an existing html page or generated on-the-fly by the program. Either way you HAVE to return something to the browser.
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Didn't try it or don't know if it does what you want but you may try:

window.history.go(-1);

when it opens the page it should directly go back to the last page.

Ron
 
if a window can close any windows it creates without prompt, can't you just have the calling page make sure the new window gets closed? oh, wait, does closing a window cause a server to terminate execution of cgi-scripts intended for that window? if so, you could add javacript to wait an arbitrary amount of time before closing it, no?
&quot;If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top