In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/01b5ef509f2ebf466fd7de2c1e7406717bb14332?hp=1cb2b5d4ff78efbd407ee199ed0ed9ff0227cecb>
- Log ----------------------------------------------------------------- commit 01b5ef509f2ebf466fd7de2c1e7406717bb14332 Author: Father Chrysostomos <[email protected]> Date: Fri Jun 7 20:16:23 2013 -0700 [perl #24482] Fix sort and require to treat CORE:: as keyword ----------------------------------------------------------------------- Summary of changes: t/comp/require.t | 11 ++++++++++- t/op/sort.t | 6 +++++- toke.c | 7 ++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/t/comp/require.t b/t/comp/require.t index ac71132..475388f 100644 --- a/t/comp/require.t +++ b/t/comp/require.t @@ -34,7 +34,7 @@ if (grep -e, @files_to_delete) { my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0; my $Is_UTF8 = (${^OPEN} || "") =~ /:utf8/; -my $total_tests = 54; +my $total_tests = 55; if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; } print "1..$total_tests\n"; @@ -211,6 +211,15 @@ if($@ =~ /Can't locate threads in \@INC/) { print "not ok - RT #24404$i\n"; } +# require CORE::foo +eval ' require CORE::lc "THREADS" '; +$i++; +if($@ =~ /Can't locate threads in \@INC/) { + print "ok $i - [perl #24482] require CORE::foo\n"; +} else { + print "not ok - [perl #24482] require CORE::foo\n"; +} + write_file('bleah.pm', qq(die "This is an expected error";\n)); delete $INC{"bleah.pm"}; ++$::i; diff --git a/t/op/sort.t b/t/op/sort.t index 03d2ce1..ca749a0 100644 --- a/t/op/sort.t +++ b/t/op/sort.t @@ -6,7 +6,7 @@ BEGIN { require 'test.pl'; } use warnings; -plan( tests => 176 ); +plan( tests => 177 ); # these shouldn't hang { @@ -119,6 +119,10 @@ cmp_ok("@b",'eq','1 2 3 4','map then sort'); cmp_ok("@b",'eq','1 2 3 4','reverse then sort'); +@b = sort CORE::reverse (4,1,3,2); +cmp_ok("@b",'eq','1 2 3 4','CORE::reverse then sort'); + + sub twoface { no warnings 'redefine'; *twoface = sub { $a <=> $b }; &twoface } eval { @b = sort twoface 4,1,3,2 }; diff --git a/toke.c b/toke.c index 1fdaa7e..d3bc457 100644 --- a/toke.c +++ b/toke.c @@ -2129,8 +2129,13 @@ S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack, in (allow_initial_tick && *s == '\'') ) { s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len); - if (check_keyword && keyword(PL_tokenbuf, len, 0)) + if (check_keyword) { + char *s2 = PL_tokenbuf; + if (allow_pack && len > 6 && strnEQ(s2, "CORE::", 6)) + s2 += 6, len -= 6; + if (keyword(s2, len, 0)) return start; + } start_force(PL_curforce); if (PL_madskills) curmad('X', newSVpvn(start,s-start)); -- Perl5 Master Repository
