develooper Front page | perl.perl5.porters | Postings from July 2008

Re: [perl #56444] Perl 5.10 breaks \N{} in regex interpolated inside regex (with charnames)

Thread Previous | Thread Next
From:
demerphq
Date:
July 10, 2008 15:44
Subject:
Re: [perl #56444] Perl 5.10 breaks \N{} in regex interpolated inside regex (with charnames)
Message ID:
9b18b3110807101544r18ffb227lb7c44ac1ed971456@mail.gmail.com
2008/7/8 Rick Delaney <rick@bort.ca>:
> On Jul 07 2008, Rafael Garcia-Suarez wrote:
>> 2008/6/29 via RT Chris Pirazzi <perlbug-followup@perl.org>:
>> > use utf8;
>> > use strict;
>> > use English qw( -no_match_vars );
>> > use charnames ':full';
>> > my $r1 = qr/\N{THAI CHARACTER SARA I}/;
>> > my $s1 = "foo";
>> > $s1 =~ /$r1+/;
> [...]
>> Interestingly, if we wrap the code from "my $r1" to the end in an
>> eval(""), then it compiles correctly. So that's some kind of
>> time-of-loading problem.
>
> I think that may just be because "\N{THAI CHARACTER SARA I}" is
> interpolated before qr// gets it.  It looks like the stringification of
> qr// references has changed as a side effect of the structure changes.

Yes this was the intent of the change, to prevent the conversion of
named escapes to strings before the regex engine saw them, otherwise
characters specified by the \N{} notation could/would be treated as
regex metachars, with not so cool consequences.

I really dont understand why its not working in this case. The second
pattern is in the same scope as the first, so this doesnt make a lot
of sense for me. I guess someone needs to look at in the debugger and
see why it thinks the charnames decl isnt in scope.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About