develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #54728] PathTools-3.27 triggers a bug in Perl

Thread Previous | Thread Next
From:
Victor Efimov via RT
Date:
August 5, 2013 15:43
Subject:
[perl #54728] PathTools-3.27 triggers a bug in Perl
Message ID:
rt-3.6.HEAD-2552-1375717368-562.54728-15-0@perl.org
On Mon Aug 05 03:51:38 2013, davem wrote:
> On Sun, Aug 04, 2013 at 04:28:32PM -0700, Victor Efimov via RT wrote:
> > So, it looks like a bug to me.
> > 
> > 1) two explanation above, with aliasing and localized global vars does
> > not apply for real localized glabal vars.
> 
> Except that $1 etc are *not* localised. The thing that is localised is the
> current match (PL_curpm internally). $1 et al are just magic vars that
> retrieve values from the current match on request.
> 
> 

Isn't it unclearly documented? 

(both cases declared as "dynamically-scoped")

http://perldoc.perl.org/perlvar.html
########
Most of the special variables related to regular expressions are side
effects. Perl sets these variables when it has a successful match, so
you should check the match result before using them. For instance:
These variables are read-only and dynamically-scoped, unless we note
otherwise.
The dynamic nature of the regular expression variables means that their
value is limited to the block that they are in, as demonstrated by this
bit of code:
########

http://perldoc.perl.org/perlsub.html
########
A local modifies its listed variables to be "local" to the enclosing
block, eval, or do FILE --and to any subroutine called from within that
block. A local just gives temporary values to global (meaning package)
variables. It does not create a local variable. This is known as dynamic
scoping. 
########

Also, isn't this a misfeature?

Seems we're going drop things like empty regexps
https://rt.perl.org/rt3/Ticket/Display.html?id=119095 (although it is
documented). And this issue much more useless and unclear imho.


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=54728

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