This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Ensure perlmodlib.pod contains all non-dual-life modules
[perl5.git] / lib / warnings.pm
index f0e2a7f..3c9ce33 100644 (file)
@@ -5,7 +5,7 @@
 
 package warnings;
 
-our $VERSION = "1.41";
+our $VERSION = "1.42";
 
 # Verify that we're called correctly so that warnings will work.
 # Can't use Carp, since Carp uses us!
@@ -450,8 +450,12 @@ sub __chk
 
     # If we have an explicit level, bypass Carp.
     if ($has_level and @callers_bitmask) {
+       # logic copied from util.c:mess_sv
        my $stuff = " at " . join " line ", (caller $i)[1,2];
-       $stuff .= ", <" . *${^LAST_FH}{NAME} . "> line $." if $. && ${^LAST_FH};
+       $stuff .= sprintf ", <%s> %s %d",
+                          *${^LAST_FH}{NAME},
+                          ($/ eq "\n" ? "line" : "chunk"), $.
+           if $. && ${^LAST_FH};
        die "$message$stuff.\n" if $results[0];
        return warn "$message$stuff.\n";
     }
@@ -540,6 +544,7 @@ delete @warnings::{qw(NORMAL FATAL MESSAGE LEVEL)};
 
 1;
 __END__
+
 =head1 NAME
 
 warnings - Perl pragma to control optional warnings