On Tuesday 25 Apr 2006 16:04, Tom Metro wrote:
> Bob Hutchinson wrote:
> > The trouble with perl system() calls is that you don't get any result
> > codes...
>
> % perldoc -f system
> system LIST
> system PROGRAM LIST
> ...
> You can check all the failure possibilities by inspecting $?
> like this:
>
> if ($? == -1) {
> print "failed to execute: $!\n";
> }
> elsif ($? & 127) {
> printf "child died with signal %d, %s coredump\n",
> ($? & 127), ($? & 128) ? 'with' : 'without';
> }
> else {
> printf "child exited with value %d\n", $? >> 8;
> }
>
>
> Or simply put, to get the familiar exit code you'd see from the shell:
>
> my $exit_code = $? >> 8;
oh good, I'll incorporate that into my script.
Thanks!
>
>
> -Tom
--
-----------------
Bob Hutchinson
Midwales dot com
-----------------
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html