Re: [PATCH] Callbacks for named captures (%+ and %-)
[p5sagit/p5-mst-13.2.git] / lib / warnings.pm
index 85ce3de..06e25c5 100644 (file)
@@ -6,7 +6,14 @@
 
 package warnings;
 
-our $VERSION = '1.04';
+our $VERSION = '1.06';
+
+# Verify that we're called correctly so that warnings will work.
+# see also strict.pm.
+unless ( __FILE__ =~ /(^|[\/\\])\Q@{[__PACKAGE__]}\E\.pm$/ ) {
+    my (undef, $f, $l) = caller;
+    die("Incorrect use of pragma '@{[__PACKAGE__,]}' at $f line $l.\n");
+}
 
 =head1 NAME
 
@@ -296,6 +303,7 @@ $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
 sub Croaker
 {
     require Carp::Heavy; # this initializes %CarpInternal
+    local $Carp::CarpInternal{'warnings'};
     delete $Carp::CarpInternal{'warnings'};
     Carp::croak(@_);
 }