Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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,

"We are not alone"(FZ)

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-08-31 20:20 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (363 votes), past polls