develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #115004] perl 5.17.x can't use @var in regexp, but only $var.

Thread Next
From:
ina cpan
Date:
September 22, 2012 12:47
Subject:
[perl #115004] perl 5.17.x can't use @var in regexp, but only $var.
Message ID:
rt-3.6.HEAD-11172-1348326859-1159.115004-75-0@perl.org
# New Ticket Created by  ina cpan 
# Please include the string:  [perl #115004]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115004 >


This is a bug report for perl from ina@cpan.org,
generated with the help of perlbug 1.39 running under perl 5.17.4.


-----------------------------------------------------------------
perl 5.17.x can't use @var in regexp, but only $var.
Is it incompatible change?

# re_pm_evalmode.pl

print "1..2\n";

$_ = 'foobar';

$pat = qr/(?{$tmp=1})/;
if (/foo${pat}bar/) {
    print "ok - 1 /foo\${pat}bar/\n";
}
else {
    print "not ok - 1 /foo\${pat}bar/\n";
}

@pat = qr/(?{$tmp=1})/;
if (/foo@{pat}bar/) {
    print "ok - 2 /foo\@{pat}bar/\n";
}
else {
    print "not ok - 2 /foo\@{pat}bar/\n";
}

__END__

re - Perl pragma to alter regular expression behaviour
http://search.cpan.org/~flora/perl/ext/re/re.pm

'eval' mode
...
For the purpose of this pragma, interpolation of precompiled regular
expressions (i.e., the result of qr//) is not considered variable
interpolation. Thus:
    /foo${pat}bar/
is allowed if $pat is a precompiled regular expression, even if $pat
contains (?{ ... }) assertions or (??{ ... }) subexpressions.
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl 5.17.4:

Configured by hinaba at Sat Sep 22 20:19:09 JST 2012.

Summary of my perl5 (revision 5 version 17 subversion 4) configuration:

  Platform:
    osname=linux, osvers=2.6.27-7-generic, archname=i686-linux
    uname='linux hinaba-desktop 2.6.27-7-generic #1 smp thu oct 30
04:18:38 utc 2008 i686 gnulinux '
    config_args='-de -Duserelocatableinc
-Dprefix=/home/hinaba/perl5/perlbrew/perls/perl-5.17.4 -Dusedevel
-Aeval:scriptdir=/home/hinaba/perl5/perlbrew/perls/perl-5.17.4/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.8.90.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.8.90'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'

Locally applied patches:


---
@INC for perl 5.17.4:
    /home/hinaba/perl5/perlbrew/perls/perl-5.17.4/lib/site_perl/5.17.4/i686-linux
    /home/hinaba/perl5/perlbrew/perls/perl-5.17.4/lib/site_perl/5.17.4
    /home/hinaba/perl5/perlbrew/perls/perl-5.17.4/lib/5.17.4/i686-linux
    /home/hinaba/perl5/perlbrew/perls/perl-5.17.4/lib/5.17.4
    .

---
Environment for perl 5.17.4:
    HOME=/home/hinaba
    LANG=ja_JP.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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