in reply to Re: Re: Re: vanishing system call
in thread vanishing system call
Nice catch on the return value of system--but in error cases, it doesn't set $!, but rather $?. Unfortunately, $? doesn't stringify nearly as nicely as $!, but you can get reasonable information (as outlined in perlvar) with a little extra work:
unless (0 == system $cmd) { warn sprintf "External command '%s' failed with exit status %d (sig +nal %d). A core dump %s\n", $cmd, $? >> 8, $? & 127, $? & 128 ? "occurred" : "did not occur"; }
|
---|