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

[perl #113750] re.pm clobbers $_

Thread Previous
From:
Marcel Grünauer
Date:
June 19, 2012 08:23
Subject:
[perl #113750] re.pm clobbers $_
Message ID:
rt-3.6.HEAD-5009-1340119416-1182.113750-75-0@perl.org
# New Ticket Created by  Marcel Grünauer 
# Please include the string:  [perl #113750]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=113750 >


This is a bug report for perl from gr@univie.ac.at,
generated with the help of perlbug 1.39 running under perl 5.16.0.


-----------------------------------------------------------------
[Please describe your issue here]

re.pm line 145 clobbers $_. This line is:

    $_ = $1;

when, I believe, it should be:

    local $_ = $1;

The line as it is causes problems if $_ is used in a loop higher up
somewhere. I don't quite understand where in my project's code I'm
doing this, but from time to time I get this error:

    Modification of a read-only value attempted at .../perl-5.16.0/lib/5.16.0/darwin-2level/re.pm line 145.

Regardless of where exactly the cause is, I think re.pm shouldn't make
an assumption about whether or not $_ is used somewhere higher up.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
    module=re
---
Site configuration information for perl 5.16.0:

Configured by marcel at Mon Jun 11 16:19:31 CEST 2012.

Summary of my perl5 (revision 5 version 16 subversion 0) configuration:
   
  Platform:
    osname=darwin, osvers=10.8.0, archname=darwin-2level
    uname='darwin macfh.cc.univie.ac.at 10.8.0 darwin kernel version 10.8.0: tue jun 7 16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386 '
    config_args='-de -Dprefix=/Users/marcel/perl5/perlbrew/perls/perl-5.16.0'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include'
    ccversion='', gccversion='4.2.1 (Apple Inc. build 5664)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/opt/local/lib'
    libpth=/opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.16.0:
    /Users/marcel/code/github/Waya/lib
    /Users/marcel/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level
    /Users/marcel/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0
    /Users/marcel/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level
    /Users/marcel/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0
    .

---
Environment for perl 5.16.0:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/marcel
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/Cellar/coreutils/8.17/libexec/gnubin:/usr/local/texlive/2010/bin/x86_64-darwin:/usr/local/mysql/bin:/opt/vim/bin:/Users/marcel/code/dev/bin/bin:/Users/marcel/code/github/Waya/bin:/Users/marcel/bin:/usr/local/bin:/usr/local/sbin:/Users/marcel/perl5/perlbrew/bin:/Users/marcel/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/X11/bin
    PERL5LIB=/Users/marcel/code/github/Waya/lib
    PERLBREW_BASHRC_VERSION=0.43
    PERLBREW_HOME=/Users/marcel/.perlbrew
    PERLBREW_MANPATH=/Users/marcel/perl5/perlbrew/perls/perl-5.16.0/man
    PERLBREW_PATH=/Users/marcel/perl5/perlbrew/bin:/Users/marcel/perl5/perlbrew/perls/perl-5.16.0/bin
    PERLBREW_PERL=perl-5.16.0
    PERLBREW_ROOT=/Users/marcel/perl5/perlbrew
    PERLBREW_VERSION=0.43
    PERL_AUTOINSTALL_PREFER_CPAN=1
    PERL_BADLANG (unset)
    PERL_EXTUTILS_AUTOINSTALL=--default-deps
    PERL_MM_USE_DEFAULT=1
    SHELL=/bin/bash


Thread Previous


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