Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Best method to capture return code from system calls?

by pbeckingham (Parson)
on Aug 24, 2005 at 14:38 UTC ( #486208=note: print w/ replies, xml ) Need Help??


in reply to Best method to capture return code from system calls?

I use the following to return both the status and the captured STDOUT/STDERR. It is not as simple as just checking for non-zero return status - there are bits that must be ignored.

sub executeCommand { my $command = join ' ', @_; reverse ($_ = qx{$command 2>&1}, $? >> 8); }
Would someone please critique this approach?



pbeckingham - typist, perishable vertebrate.


Comment on Re: Best method to capture return code from system calls?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2015-07-05 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls