On 12/11/06, Howard Lowndes <[EMAIL PROTECTED]> wrote:

OK, I have put some debugging into the Perl script and I have isolated
the problem down to this piece of code (including my debug code):

     flock( PIPE_IN, LOCK_EX );
my $lannet_err = $?;
     print PIPE_IN $input;
my $lannet_err = $lannet_err.",".$?;
     flock( PIPE_IN, LOCK_UN );
my $lannet_err = $lannet_err.",".$?;
     close(PIPE_IN);
my $lannet_err = $lannet_err.",".$?;
     if ($? and not $ignerror) {
         unless($silent) {
             handle_error( $err_msges[1], ( $lannet_err.$pipecmd, $? >>
8, $!, $tmpfile ) );
         }
         unlink($tmpfile);
         unlink($errfile);
         return ( $?, [EMAIL PROTECTED], [EMAIL PROTECTED] );
     }



Now, in order, the $? variable returns: 32512,32512,32512,256
So, can anyone have a go at interpreting what these error code mean in


They don't mean anything - both because you probably want to look at $!
(mnemonic: "What went Bang?") and even then it won't mean anything as long
as you don't check flock's return value - quoting the first two sentences in
flock's documentation:
"Calls flock(2), or an emulation of it, on FILEHANDLE. Returns true for
success, false on failure."

http://perldoc.perl.org/functions/flock.html

and $!'s value isn't guaranteed to be anything as long as the system call
returned without an error (hence the requirement to check the return value
before looking at $!).

this context; they appear very odd to me.  Also, what does "$? >> 8" do


The exit value of a child process is shifted 8 bits to the left to leave
space for the signal which killed the child process (if any). Lookup "$?"
(and "$!") in http://perldoc.perl.org/perlvar.html

in the second array element, is it an 8 bitwise shift of 256, because
it's output value is sprintf'd as "1"?


It means that the chuld process' exit value is "1", probably due to some
error. This sits well with that "256" in your comma-separated list of
numbers.

--P
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to