[kw-pm] Executing commands using tics

fishbot eric at uc.org
Tue Mar 16 06:20:34 PDT 2010


If you have Perl 5.10, then is there a reason we are missing that 
you cannot just use Compress::Zlib or IO::Uncompress::Gunzip 
directly?  Both are core modules from 5.9.

Example:

    use IO::Uncompress::Gunzip qw{ gunzip $GunzipError };

    my $payload;
    gunzip( $filename, \$payload )
       or die( "Couldn't decompress '$filename': $GunzipError\n"
    );

    print $payload;

That looks like a lot more fun than trying to understand the 
nuances of IPC on Win32.

If there is some reason this won't work for you, then I would 
suggest trying an Open3 with fully disassociated in/out/err 
descriptors.  That is more tedious, but relatively simple.


---- original message : 2010-03-15 6:53pm : Robert Pike ----

> $result = `gunzip -cf <filepath`;
>
> Windows 2003 Server it's running on. I compile the code using
> activestate's PDK app which uses activestate's Perl version 5.10 build
> 1007.
>
> --- On Mon, 3/15/10, fishbot <eric at uc.org> wrote:
>
>> From: fishbot <eric at uc.org>
>> Subject: Re: [kw-pm] Executing commands using tics
>> To: "Robert Pike" <roberthpike at yahoo.com>
>> Cc: "KW Perl Mongers" <kw-pm at pm.org>
>> Received: Monday, March 15, 2010, 8:08 PM
>>
>> You need to share your platform info (I assume Windows...
>> but cygwin? ActiveState?  Strawberry?) and the code.
>>
>> Actually, this would be useful too:
>>
>>    print 0 + $!;
>>
>> I am -guessing- that $! is ENOTTY(25) because that is a lot
>> like what
>> the message for ENOTTY looks like for *nix.
>>
>> Which might also explain why you would see it in a context
>> without a
>> TTY, but don't see it on the command line.
>>
>> ---- original message : 2010-03-15 11:27am : Robert Pike
>> ----
>>
>>> Has anyone run commands using tics from a Perl CGI
>> application? I'm
>>> trying to run gunzip command and other commands using
>> tics but it's
>>> not working. If I wrap the statement in an eval
>> statement the $! gets
>>> set to "Inappropriate I/O control operation" after the
>> attempt to
>>> execute it occurs. Any ideas on how I can get this up
>> and running? A
>>> very similar script I had seemed to work fine from
>> command line.
>>> Thanks, in advance, for any help.
>> 
>
>
>      __________________________________________________________________
> Looking for the perfect gift? Give the gift of Flickr! 
>
> http://www.flickr.com/gift/
>


More information about the kw-pm mailing list