|
|
| Keep It Simple, Stupid | |
| PerlMonks |
close and autodie on pipesby apomatix (Novice) |
| on Jun 29, 2012 at 18:06 UTC ( #979163=perlquestion: print w/ replies, xml ) | Need Help?? |
|
apomatix has asked for the
wisdom of the Perl Monks concerning the following question:
I want to get both the output and status of a pipe. Here is a working example:
Fine. It outputs
Now let's try to use autodie:
No good, that breaks it:
It is the "close" statement. So we can take that out.
Now it is broken differently---it has lost the exit status:
I need to call close in order to get the exit status of a pipe. So now I have settled on this ugly thing:
That seems to work, but I'm not doing any error checking on the close statement: Can I use close with autodie when my pipe fails? If not, how should I check for errors?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||