Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Handling weird return values with or die

by jeroenes (Priest)
on Jul 05, 2001 at 16:31 UTC ( #94073=note: print w/ replies, xml ) Need Help??


in reply to Handling weird return values with or die

But with system that is different. See the doc. Check for a number of -1 to die on start failure:

system("blah foo beer!") <> -1 or die "error: $?";

To die on the exit call, maybe you'd better use some elaborate sceme:

system( @args ) == 0 or syscall_error( $?, "system @args" ); sub syscall_error( my $error = shift; my $name = shift; die "$name failed: $!" if $error == -1; die "$name returned error: ", $error >> 8, ", signal: ", $error & 127, " and dumped_core: ", $error & 128; }
The last sub pulled from the literal info in system.

Hope this helps,

Jeroen
"We are not alone"(FZ)
Updated


Comment on Re: Handling weird return values with or die
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2015-07-05 04:29 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