David Nicol <[EMAIL PROTECTED]> writes:

> On 5/12/05, Ton Hospel <[EMAIL PROTECTED]> wrote:
> > And isn't a simular fix needed for the returncode of system() ?
> 
> fascinating stuff.  Would it make sense to abstract return code massaging
> into a macro, possibly different per-platform?

It is already a macro and this macro is already used on the returncode
of system.  The macro was the one that I patched (indirectly).

Another way to fix this to to make $? be exactly those 16 bits
described by this code segment found in description of system in
perlfunc:

| You can check all the failure possibilities by inspecting
| C<$?> 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;
|     }

and then we could drop this text:

| or more portably by using the W*() calls of the POSIX extension;
| see L<perlport> for more information.

and then introduce a variable like ${^NATIVE_CHILD_ERROR} that would
hold the real 'status' from wait*(2).  The ${^NATIVE_CHILD_ERROR}
would be to $? what $^E is to $!.

Regards,
Gisle

Reply via email to