Change 14040 by jhi@alpha on 2002/01/03 15:05:06

        Subject: [PATCH lib/Carp/Heavy.pm lib/Carp.t] obscure warning from Carp::Heavy
        From: Robin Barker <[EMAIL PROTECTED]>
        Date: Thu, 3 Jan 2002 15:26:20 GMT
        Message-Id: <[EMAIL PROTECTED]>            

Affected files ...

.... //depot/perl/lib/Carp.t#3 edit
.... //depot/perl/lib/Carp/Heavy.pm#19 edit

Differences ...

==== //depot/perl/lib/Carp.t#3 (text) ====
Index: perl/lib/Carp.t
--- perl/lib/Carp.t.~1~ Thu Jan  3 08:15:05 2002
+++ perl/lib/Carp.t     Thu Jan  3 08:15:05 2002
@@ -5,7 +5,7 @@
 
 use Carp qw(carp cluck croak confess);
 
-print "1..8\n";
+print "1..9\n";
 
 print "ok 1\n";
 
@@ -56,3 +56,16 @@
 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";

==== //depot/perl/lib/Carp/Heavy.pm#19 (text) ====
Index: perl/lib/Carp/Heavy.pm
--- perl/lib/Carp/Heavy.pm.~1~  Thu Jan  3 08:15:05 2002
+++ perl/lib/Carp/Heavy.pm      Thu Jan  3 08:15:05 2002
@@ -237,6 +237,7 @@
 sub trusts_directly {
     my $class = shift;
     no strict 'refs';
+    no warnings 'once'; 
     return @{"$class\::CARP_NOT"}
       ? @{"$class\::CARP_NOT"}
       : @{"$class\::ISA"};
End of Patch.

Reply via email to