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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forking, or something similar

Status
Not open for further replies.

Archon

Programmer
May 1, 2001
17
0
0
US
Hey guys, quick question for ya.

I'm making a simple page that lets the user know he's being redirected to the file he's previously chosen.

For the redirection I used the syntax:
<meta http-equiv=&quot;refresh&quot; content=&quot;5&quot;; url=$url&quot;>

This works fine and it pauses for those 5 seconds before redirecting. Now, the problem comes in here... I'd like to (after redirecting) sleep for 30 seconds giving the user time to download the file, then delete it.

What's the best way to implement this? I tried using a fork, that forks.. sleeps.. deletes. But it keeps implementing the sleep before it redirects. So I end up staring at a notification of redirection for 30 seconds, then get redirected to a file that doesn't exist anymore. So i assume the fork isn't working.

Could I get code syntax w/ any ideas? Not even close to a perl expert.

Thanks.
 
maybe all you need to do is set $| = 1; # &quot;autoflush&quot;

In general terms, Perl buffers it output. Consequently, your redirect might be getting stuck in the 'buffer' where it sits as the sleep is initiated. The 'buffer' is automatically flushed when the program closes and the redirect instructions are then finally completed to the browser(after the sleep has completed). If you set $| = 1; , then, that forces the buffer to 'flush' after every write or print.

Forks are not hard to do, but, it does not seem necessary here.

HTH


keep the rudder amid ship and beware the odd typo
 
I always set autoflush at the top of every program I write. It doesn't seem to hurt anything, and helps on those strange occasions. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Well, adding the autoflush and taking out the fork is fine... for everything but older versions of netscape. Works in newer IE and Netscape both. Still sticks on old netscape though.

 
send a header instead of a http-equiv? --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top