From: Jarkko Hietaniemi Date: Sat, 9 Aug 2003 07:34:16 +0000 (+0000) Subject: Fix from Dave Mitchell to the recent from lib/Devel/SelfStubber.t: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2611e30b2cfc225355f77ac14b45bee31bc2bf54;p=p5sagit%2Fp5-mst-13.2.git Fix from Dave Mitchell to the recent from lib/Devel/SelfStubber.t: Variable "$nested" is not available at (re_eval 4) line 2, line 8. which was on old bug unearthed by the change #20559. Basically, qr// + (??{$lexical}) combination is very, VERY broken. Workaround is not to use lexicals. p4raw-link: @20559 on //depot/perl: 2740392c45d51e34cd904b51afcc00544a78cf82 p4raw-id: //depot/perl@20578 --- diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm index 59defe0..3b810dd 100644 --- a/lib/SelfLoader.pm +++ b/lib/SelfLoader.pm @@ -10,10 +10,12 @@ $DEBUG = 0; my %Cache; # private cache for all SelfLoader's client packages # allow checking for valid ': attrlist' attachments -my $nested; +# (we use 'our' rather than 'my' here, due to the rather complex and buggy +# behaviour of lexicals with qr// and (??{$lex}) ) +our $nested; $nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x; -my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x; -my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x; +our $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x; +our $attr_list = qr{ \s* : \s* (?: $one_attr )* }x; sub croak { require Carp; goto &Carp::croak }