Hi, List,

First thank you for the help you provide. I follow this list quite a time
and learned a lot.

My problem, or question, respectively:
To test our software I use perl to start it several times. My perl script
gather some information and start then the program with different
parameters.

It works very well, but I have a problem with the return values of our
program. This return codes are all in an area from 55000 to 60000.
I use open to invoke our program and print the output. Finally I use the $?
variable and print the error code in case of an error.

sub start_test_runner {
my ($tr = shift, $tr_params) = @_;
 my $pid = open(my $trexe, "$tr \"$tr_params\" |") or die "Could not start
TestRunner. $!\n";
 while(<$trexe>) {
 print $_ if $verbose;
}
waitpid($pid, 0);
close($trexe);
my $tr_ret = ($?>>8);

return $tr_ret;
}

now I read the perldoc perlvar section about $? and realised that only the
above 8 bits are used for the return value. The first 8 bit are used for
the system codes. As far as I that understand fit just 256 values in those
8 bits.
Obviously, the error codes given back from my scripts are always wrong.
For example, if the error code is 55028 I get 62464. With right shift the
script prints 244.

Is there another way in perl to get the proper return codes?

Thanks,
Wolfgang

Reply via email to