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;


 -Tom

--
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html

Reply via email to