Skip Menu |
 

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

Report information
The Basics
Id: 36641
Status: new
Priority: 0/
Queue: Test-NoWarnings

People
Owner: Nobody in particular
Requestors: matt.lawrence [...] virgin.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.083
Fixed in: (no value)



Subject: Edge case with warnings occurring after END
Download (untitled) / with headers
text/plain 650b
Warnings encountered after the Test::NoWarnings END block cause misleading errors: (in cleanup) Can't call method "current_test" on an undefined value at /usr/local/lib/perl5/site_perl/5.8.7/Test/NoWarnings/Warning.pm line 74 during global destruction. This was caused by a fatal error in a DESTROY method elsewhere (which is transformed into a warning) occurring after the Test::Builder object had gone out of scope. The attached test case demonstrates the problem. Note that there is no warning without the -w flag, even with the warnings pragma enabled. Also note that the warning is not suppressed when Test::NoWarnings is not loaded.
Subject: test_case.pl
Download test_case.pl
text/x-perl 292b
use strict; use warnings; # Build an object that will go out of scope after Test::NoWarning's END block BEGIN { our $object = bless {} } use Test::Simple tests => 1; use Test::NoWarnings; # This will get called when $object goes out of scope sub DESTROY { die "Important error message" }
Subject: nowarnings.diff
Download nowarnings.diff
text/x-diff 447b
--- /usr/local/lib/perl5/site_perl/5.8.7/Test/NoWarnings.pm 2008/06/10 16:03:49 1.1 +++ /usr/local/lib/perl5/site_perl/5.8.7/Test/NoWarnings.pm 2008/06/11 09:11:46 @@ -42,7 +42,10 @@ # before Test::Builder's end block # only run the test if there have been other tests END { - had_no_warnings() if $do_end_test; + if ($do_end_test and $$ == $PID) { + had_no_warnings(); + delete $SIG{__WARN__}; + } } sub make_warning


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.