* Zephaniah E. Hull via RT (bug-Log-Report@rt.cpan.org) [110526 23:27]:
Show quoted text> Thu May 26 19:27:25 2011: Request 68496 was acted upon.
> Transaction: Ticket created by zhull@jetpay.com
> Queue: Log-Report
> Subject: Log::Report::report exits with a status code of 0 by default.
>
> The documentation for report states that the exit status is the value of
> the errno option, and that the default if the errno option is not
> provided (due to being called as error or the like) is $! or 1.
>
> The code (in Report.pm, v0.92, line 147) reads:
> $^S or exit($opts->{errno} || 0);
> This ignores $? and defaults to 0.
There certainly is a problem, but this location is also showing the effect.
Further down, in report() the error is collected
$opts->{errno} ||= $!+0 # want copy!
if $use_errno{$reason} && !defined $opts->{errno};
So, if you write
system(...) and fault "error";
Actually, using system() whole my live, I still do not know the
cleanest way to handle system calls which report both $! and $?
errors. Those error-code ranges do overlap. $? is very platform
dependent.
Show quoted text> The result is that a program that calls error() will exit with an exit
> status of 0, indicating to the parent program that it exited without error.
> This is obviously incorrect.
True.
Maybe we should change above line into
$opts->{errno} ||= $!+0 || $? || 1
if $use_errno{$reason} && !defined $opts->{errno};
What do you think?
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark@Overmeer.net solutions@overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net