From: Robin Barker Date: Thu, 3 Jan 2002 15:26:20 +0000 (+0000) Subject: obscure warning from Carp::Heavy X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b5777b261727bad592dbbe6d1c792d2f010dd753;p=p5sagit%2Fp5-mst-13.2.git obscure warning from Carp::Heavy Message-Id: <200201031526.PAA06095@tempest.npl.co.uk> p4raw-id: //depot/perl@14040 --- diff --git a/lib/Carp.t b/lib/Carp.t index e9dd8cd..2ea98d8 100644 --- a/lib/Carp.t +++ b/lib/Carp.t @@ -5,7 +5,7 @@ BEGIN { use Carp qw(carp cluck croak confess); -print "1..8\n"; +print "1..9\n"; print "ok 1\n"; @@ -56,3 +56,16 @@ my $eval = "use Carp::Heavy; return Carp::caller_info(0);"; my %info = eval($eval); print "not " if ($info{sub_name} ne "eval '$eval'"); print "ok 8\n"; + +# test for '...::CARP_NOT used only once' warning from Carp::Heavy +my $warning; +eval { + BEGIN { + $^W = 1; + $SIG{__WARN__} = + sub { if( defined $^S ){ warn $_[0] } else { $warning = $_[0] } } + } + package Z; + BEGIN { eval { Carp::croak() } } +}; +print $warning ? "not ok 9\n#$warning" : "ok 9\n"; diff --git a/lib/Carp/Heavy.pm b/lib/Carp/Heavy.pm index cf10892..c3d3c26 100644 --- a/lib/Carp/Heavy.pm +++ b/lib/Carp/Heavy.pm @@ -237,6 +237,7 @@ sub trusts { sub trusts_directly { my $class = shift; no strict 'refs'; + no warnings 'once'; return @{"$class\::CARP_NOT"} ? @{"$class\::CARP_NOT"} : @{"$class\::ISA"};