Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 surveying the Monastery: (10)
As of 2014-10-23 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls