diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-02-07 16:49:38 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-02-07 16:53:37 -0800 |
commit | 018c7c82242b909397f06dbd208a750677dd822a (patch) | |
tree | b9b6508a8218a9e06d13b8d20c72496e417835a6 /cpan/Parse-CPAN-Meta/uupacktool.pl | |
parent | 76cc22ec8d16738e37cbdd3bb7205aed330bd0e7 (diff) | |
download | perl-018c7c82242b909397f06dbd208a750677dd822a.tar.gz |
[perl #82854] utf8, $SIG{__DIE__}, syntax errors and Carp
If a syntax error has occurred, module loading causes the ‘BEGIN not
safe after errors’ error.
As of perl 5.12.0 (commit 7d0994e05, actually), error messages men-
tioning variable names that originate from ‘use utf8’ scopes and are
passed to __DIE__ handlers correctly have the UTF8 flag turned on, so
that a variable named $ġ will actually cause the error message to con-
tain ‘$ġ’, rather than ‘$Ä¡’. (As a side effect, even if the variable
does not contain non-ASCII characters, the error message still gets
the UTF8 flag turned on.)
Carp was using a \d in a regular expression against the error message.
\d loads Unicode tables if the LHS has the UTF8 flag turned on.
This means that this snippet:
use utf8;
use strict;
use CGI::Carp 'fatalsToBrowser';
$c;
dies with ‘BEGIN not safe...’, because the error message that triggers
it is ‘Global symbol "$c" requires explicit package name’, it has the
UTF8 flag turned on, CGI::Carp passes it to Carp.pm, Carp tries to do
a /\d/ match against it and \d tries to load Unicode tables, dying
with ‘BEGIN not safe...‘.
This commit just changes the \d in Carp.pm to [0-9], since that is
what was intended anyway.
Diffstat (limited to 'cpan/Parse-CPAN-Meta/uupacktool.pl')
0 files changed, 0 insertions, 0 deletions