Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: how to properly handle the closing of pipe? read from the pipe unzip-c and get out before

by Eliya (Priest)
on Mar 29, 2011 at 15:47 UTC ( #896210=note: print w/ replies, xml ) Need Help??


in reply to Re: how to properly handle the closing of pipe? read from the pipe unzip-c and get out before
in thread how to properly handle the closing of pipe? read from the pipe unzip-c and get out before

In your croak statement, you should be using $!, not $ERRNO.

Why?  As he's using English, $ERRNO should be the same as $!.


Comment on Re^2: how to properly handle the closing of pipe? read from the pipe unzip-c and get out before
Select or Download Code
Re^3: how to properly handle the closing of pipe? read from the pipe unzip-c and get out before
by Illuminatus (Curate) on Mar 29, 2011 at 16:23 UTC
    You are right, of course. I never use anything but $!, so I had forgotten this. The OP error output seemed to indicate that $ERRNO was blank. I was unsure as to why, or whether he simply omitted it. At any rate, it looks like his problem was fixed by changing the params to unzip

    fnord

      unzip fixed - yes,but error after the close of the pipe is still
      $ perl pipe_quest.pl
      unable to close: unzip -p test.zip utp.live.stp.published.messages.txt at pipe_quest.pl line 29
      mishin
        Another check of the unzip man page yields the likely reason for your problem. Closing a pipe causes the writer (unzip in this case) to receive SIGPIPE. unzip subsequently returns a non-zero exit status (sets $? to SIGPIPE, or 13), which may be causing croak to fire. You may want to change you logic to not croak if the close fails, but $? is set to 13

        fnord

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://896210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (15)
As of 2013-05-22 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (470 votes), past polls