Skip Menu |

This queue is for tickets about the Test-Exit CPAN distribution.

Report information
The Basics
Id: 87495
Status: resolved
Priority: 0/
Queue: Test-Exit

People
Owner: Nobody in particular
Requestors: MAUKE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.03
Fixed in: (no value)



Subject: exit override has wrong precedence / prototype
% perl -e 'my @x = 0; exit @x'; echo $? 1 % perl -e 'use Test::Exit; my @x = 0; exit @x'; echo $? 0 These two should produce the same output. % perl -e 'exit 0 | 1'; echo $? 0 % perl -e 'use Test::Exit; exit 0 | 1'; echo $? 1 As should these. Test::Exit's 'exit' override lacks CORE::exit's (;$) prototype that gives it higher precedence and forces scalar context on the argument.
On Wed Jul 31 16:01:32 2013, MAUKE wrote: Show quoted text
> Test::Exit's 'exit' override lacks CORE::exit's (;$) prototype that > gives it higher precedence and forces scalar context on the argument.
Patch attached.
Subject: Test-Exit-prototype.patch
diff -ru Test-Exit-0.03-hax/lib/Test/Exit.pm Test-Exit-0.03/lib/Test/Exit.pm --- Test-Exit-0.03-hax/lib/Test/Exit.pm 2013-07-31 22:02:48.000000000 +0200 +++ Test-Exit-0.03/lib/Test/Exit.pm 2009-12-04 11:42:55.000000000 +0100 @@ -19,7 +19,7 @@ CORE::exit $value; }; BEGIN { - *CORE::GLOBAL::exit = sub (;$) { $exit_handler->(@_) }; + *CORE::GLOBAL::exit = sub { $exit_handler->(@_) }; }
On Wed Jul 31 16:06:29 2013, MAUKE wrote: Show quoted text
> On Wed Jul 31 16:01:32 2013, MAUKE wrote:
> > Test::Exit's 'exit' override lacks CORE::exit's (;$) prototype that > > gives it higher precedence and forces scalar context on the argument.
> > Patch attached.
Sigh. The above patch is reversed. Fixed version attached.
Subject: Test-Exit-prototype.patch
diff -ru Test-Exit-0.03/lib/Test/Exit.pm Test-Exit-0.03-hax/lib/Test/Exit.pm --- Test-Exit-0.03/lib/Test/Exit.pm 2009-12-04 11:42:55.000000000 +0100 +++ Test-Exit-0.03-hax/lib/Test/Exit.pm 2013-07-31 22:02:48.000000000 +0200 @@ -19,7 +19,7 @@ CORE::exit $value; }; BEGIN { - *CORE::GLOBAL::exit = sub { $exit_handler->(@_) }; + *CORE::GLOBAL::exit = sub (;$) { $exit_handler->(@_) }; }