http://qs321.pair.com?node_id=322916


in reply to How to Trap exit code from system calls

You could always just use a system call. Below is what the docs say about checking exit values and such.
Because system() and backticks block SIGINT and SIGQUIT, killing the p +rogram they're running doesn't actually interrupt your program. @args = ("command", "arg1", "arg2"); system(@args) == 0 or die "system @args failed: $?" You can check all the failure possibilities by inspecting $? like this +: $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128;

- Tom

Replies are listed 'Best First'.
Re: Re: How to Trap exit code from system calls
by emjga1 (Novice) on Jan 22, 2004 at 11:02 UTC
    Tom

    Thanks , I had looked at $? but did not get the expected answers from it
    and asumed I was doing somthing wrong.

    But using
    $exit_value  = $? >> 8;

    Does just the job.

    Thanks

    Matt