This is coming from left field, and the gurus should chime in, and I 
have been reading up about IPC last couple of days so this is on the 
brain, but would setting up a signal handler (don't know what signal it 
would be receiving, obviously this would need to be determined) help?  I 
would think that the END would be called, but if the script is receiving 
a signal then maybe in this case an END is never reached???

Random thoughts after a long day........

http://danconia.org

Octavian Rasnita wrote:
> Hi all,
> 
> After fighting a lot with a bigger script, I could make it work under
> Windows 2000, but it can't work under Red Hat 7.2 unfortunately.
> 
> It is that script for downloading a file then delete it from the server.
> 
> If the file finish downloading, it is deleted from the server using Windows
> and Linux.
> If the user starts downloading, or only opens the window that asks if they
> want to save or open the file, then cancel the download, the file is not
> deleted from the server under Linux.
> It is deleted from Windows however.
> 
> I use Apache 2.0.3.6 in Windows, and Apache 1.32 in Linux.
> 
> I've tried again that simple script version, and it works the same. I've
> attached it here below if you would like to take a look.
> 
> I've tried putting the "unlink $file" line in an END { ... } but this block
> it is not executed if the download is cancelled.
> 
> Do you have any idea if I have any solution to make it work?
> 
> Thank you very much!
> Here is the script:
> 
> #!/usr/bin/perl
> 
> $| = 1;
> 
> my $filename = $ENV{'QUERY_STRING'};
> my $docroot = $ENV{'DOCUMENT_ROOT'};
> my $file = "$docroot/shopping/$filename";
> 
> print <<eof;
> Content-type: application/zip
> Content-Disposition: attachment; filename=$filename
> 
> eof
> 
> open (FH, $file);
> binmode(FH);
> binmode(STDOUT);
> 
> until (eof FH) {
> read (FH, my $buf, 1);
> print $buf;
> }
> close FH;
> 
> END {
> unlink $file;
> }
> 
> 
> Teddy Center: http://teddy.fcc.ro/
> Mail: [EMAIL PROTECTED]
> 
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to