Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Pipe Error Trapping

by dpuu (Chaplain)
on Aug 24, 2004 at 16:13 UTC ( #385434=note: print w/replies, xml ) Need Help??


in reply to Pipe Error Trapping

When opening a command to a pipe, the open command will only fail if the command you're trying to run (gzcat) doesn't exist. You need to check if the command found an error, after it started running.

The solution is to check the return value of other functions -- specifically, the close function:

open IN, "cat foo|" or die "failed to open: $!"; while (<IN>) { print } close IN or die "failed to close: $!";
--Dave
Opinions my own; statements of fact may be in error.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://385434]
help
Chatterbox?
[shmem]: karlgoethebier, yep. Thanks anyways, post done, and esel happy :-)
[LanX]: shmem: ah I see ... you'll need to check if the monastery standard classes come with border ... like the nodelets should
[karlgoethebier]: shmem: you could have linked to jackass as well ;-)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2017-07-24 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (356 votes). Check out past polls.