"copy" from File::Copy fails but returns success
- From: Henry Law <news@xxxxxxxxxxxxx>
- Date: Tue, 16 Oct 2007 09:43:49 +0100
The CGI program, running under Apache, supports download of a file from a Linux server running Perl 5.8.6. The files are stored compressed, so the download program first copies the compressed file to a temporary directory, then uncompresses it and handles the HTTP for the download. My problem is that the use of "copy" from File::Copy appears to succeed (with a TRUE return code) but then when I go to uncompress the file it's not there.
Because of the CGI environment it's hard to give a fully-runnable fragment, but here's the core of it.
$rc = copy ("/home/nfb/temp.txt", "/tmp/nfb");
my $output = "Return code:$rc<br>" . `ls -l /tmp/nfb`;
print "Content-type: text/html\n\n<html><body><p>$output</p></body></html>\n";
exit 0;
The source file exists and is chmod 777. The result from the code above is
Return code:1
-rw-r--r-- 1 apache apache 5 Oct 16 09:34 /tmp/nfb
.... which shows that the copy succeeded (return code 1) but the file is nevertheless not in the target directory /tmp/nfb. I'm baffled.
Any ideas? If you think it's a Linux or Apache configuration problem then please say so and I'll take this to the relevant group; but this code worked a few weeks ago and I've not touched the Apache configuration since.
--
Henry Law Manchester, England
.
- Follow-Ups:
- Re: "copy" from File::Copy fails but returns success
- From: Sherman Pendley
- Re: "copy" from File::Copy fails but returns success
- From: Paul Lalli
- Re: "copy" from File::Copy fails but returns success
- From: Brian Wakem
- Re: "copy" from File::Copy fails but returns success
- From: Josef Moellers
- Re: "copy" from File::Copy fails but returns success
- Prev by Date: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
- Next by Date: Setting perl's output buffer size
- Previous by thread: FAQ 6.12 What does it mean that regexes are greedy? How can I get around it?
- Next by thread: Re: "copy" from File::Copy fails but returns success
- Index(es):
Relevant Pages
|
|