The perl docs actually do have a good explanation
of what the return value from system() is, but it's
in "perldoc perlvar" instead of "perldoc -f system". system() returns the value of $? after the
wait() is done.
Here it is:
$? The status returned by the last pipe close, backtick
(``) command, or system() operator. Note that this
is the status word returned by the wait() system
call (or else is made up to look like it). Thus,
the exit value of the subprocess is actually ($? >>
8), and $? & 127 gives which signal, if any, the
process died from, and $? & 128 reports whether
there was a core dump. (Mnemonic: similar to sh and
ksh.)
Just to clarify, $? >> 8 is bitshifting by 8, which is essentially dividing by 256. So, if you are getting
a return val of 256 from system(), your spawned program did
an exit(1). | [reply] [d/l] |
You mean...
$result = system("foo")
sets $result to 256? It means "foo" returned 1. Read
"man foo" to see what that means - probably something went
wrong. Or not. I need more information to be helpful. | [reply] [d/l] |
AFAIK it's application dependent. system() returns the application status/exit code, so whatever the application passes along as exit code is catcheable in your perl code. 256 could be anything really :)
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur. | [reply] [d/l] |