diff options
author | Robin Barker <RMBarker@cpan.org> | 2002-01-03 15:26:20 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-01-03 15:05:06 +0000 |
commit | b5777b261727bad592dbbe6d1c792d2f010dd753 (patch) | |
tree | d9b65583c2503e1e881abf20665a3200293b8122 | |
parent | d5afce772893fe92cef0682fe9672d2589df7ab5 (diff) | |
download | perl-b5777b261727bad592dbbe6d1c792d2f010dd753.tar.gz |
obscure warning from Carp::Heavy
Message-Id: <200201031526.PAA06095@tempest.npl.co.uk>
p4raw-id: //depot/perl@14040
-rw-r--r-- | lib/Carp.t | 15 | ||||
-rw-r--r-- | lib/Carp/Heavy.pm | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Carp.t b/lib/Carp.t index e9dd8cd7f5..2ea98d86d7 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 cf108923f4..c3d3c26fa1 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"}; |