summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2018-02-26 09:23:28 -0800
committerFather Chrysostomos <sprout@cpan.org>2018-02-27 09:15:56 -0800
commita0da1e165c011c775b9f39a37ab6d3dd6a1c0969 (patch)
tree5e37b8b6989c5f77f592252b42165ce10928acf2 /lib
parent5c8d1071aaf72214e66b1a224890384ab6ca5153 (diff)
downloadperl-a0da1e165c011c775b9f39a37ab6d3dd6a1c0969.tar.gz
warnings.pm: _at_level functions and chunky handles
The _at_level functions, which have to bypass Carp, were not reporting non-line-based filehandles correctly. The perl core does: ..., <fh> chunk 7. if $/ is not "\n". warnings.pm should do the same. It was using ‘line’.
Diffstat (limited to 'lib')
-rw-r--r--lib/warnings.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index f0e2a7fcdd..af23f909b7 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -450,8 +450,11 @@ 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 .= ", <" . *${^LAST_FH}{NAME} . "> "
+ . ($/ eq "\n" ? "line" : "chunk") . " $."
+ if $. && ${^LAST_FH};
die "$message$stuff.\n" if $results[0];
return warn "$message$stuff.\n";
}