summaryrefslogtreecommitdiff
path: root/lib/utf8_heavy.pl
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-01-16 14:16:20 +0000
committerDavid Mitchell <davem@iabyn.com>2011-01-16 14:16:20 +0000
commitd658a8a81c4f311bef688fd51df924a424429f14 (patch)
treec90aa43119f05a7732d7f1fac94f8c0eae753002 /lib/utf8_heavy.pl
parent95a517db36c4d56cf2a5e6103e3235de4c1c38f8 (diff)
downloadperl-d658a8a81c4f311bef688fd51df924a424429f14.tar.gz
restrict \p{IsUserDefined} to In\w+ and In\w+
In L<perlunicode/"User-Defined Character Properties">, it says you can create custom properties by defining subroutines whose names begin with "In" or "Is". However, perl doesn't actually enforce that naming restriction, so \p{foo::bar} will call foo::Bar() if it exists. This commit finally enforces this convention. Note that this broke a number of existing tests for properties, since they didn't always use an Is/In prefix.
Diffstat (limited to 'lib/utf8_heavy.pl')
-rw-r--r--lib/utf8_heavy.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl
index 0a98732cbd..e271ba3a73 100644
--- a/lib/utf8_heavy.pl
+++ b/lib/utf8_heavy.pl
@@ -100,7 +100,7 @@ sub croak { require Carp; Carp::croak(@_) }
my $caller1 = $type =~ s/(.+)::// ? $1 : caller(1);
- if (defined $caller1 && $type =~ /^(?:\w+)$/) {
+ if (defined $caller1 && $type =~ /^I[ns]\w+$/) {
my $prop = "${caller1}::$type";
if (exists &{$prop}) {
no strict 'refs';