[LA.pm] calling gzip from within perl

Peter Benjamin pete at peterbenjamin.com
Wed Jun 29 12:47:53 PDT 2005


At 12:02 PM 6/29/2005, Jeremy Leader wrote:
>Peter Benjamin wrote:
>> At 10:21 PM 6/28/2005, David Heayn wrote:
>>>       open(FILE, "gunzip $fileLoc |") or die "Cannot gunzip '$fileLoc': $!";
>>>       my @stuff = <FILE>;
>>>       close(FILE);
><snip>
>> 
>> Does your script use STDIN?  If so, then
>> this method of re-using STDIN (the pipe after the filename in
>> the open) would cause problems.  They share the same /dev/*
>> file name that STDIN uses.  As it appears to be a CGI script
>> I suppose you will not be able to re-use STDIN using the |
>> inside the open.
>
>But the snippet of code above doesn't use STDIN.

You're right, it uses STDOUT.  I should not reply past midnight.
CGI scripts also use STDOUT to send data back to the web server,
so the point of reuse still applies, only now to STDOUT.

Thanks for the correction Jeremy.






More information about the Losangeles-pm mailing list