Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://94073]
help
Chatterbox?
and a soft breeze sighs...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2016-12-04 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (61 votes). Check out past polls.