develooper Front page | perl.perl5.porters | Postings from November 2011

[perl #105024] UNIVERSAL::AUTOLOAD breaks named captures/%-/%+

Thread Previous
From:
l . mai @ web . de
Date:
November 30, 2011 13:40
Subject:
[perl #105024] UNIVERSAL::AUTOLOAD breaks named captures/%-/%+
Message ID:
rt-3.6.HEAD-5084-1322689187-1769.105024-75-0@perl.org
# New Ticket Created by  l.mai@web.de 
# Please include the string:  [perl #105024]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=105024 >



This is a bug report for perl from l.mai@web.de,
generated with the help of perlbug 1.39 running under perl 5.12.3.


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

% perl -wle '{ package UNIVERSAL; sub AUTOLOAD { warn "$AUTOLOAD(@_)" } } "a" =~ /(?<X>.)/ or die; print "$+{X}"'                                                       
IO::File::DESTROY(IO::File=IO(0x9447790)) at -e line 1.
Use of uninitialized value $+{"X"} in string at -e line 1.

% perl -wle '%- if 0; { package UNIVERSAL; sub AUTOLOAD { warn "$AUTOLOAD(@_)" } } "a" =~ /(?<X>.)/ or die; print "$+{X}"'
IO::File::DESTROY(IO::File=IO(0x823f798)) at -e line 1.
a
Tie::Hash::NamedCapture::DESTROY(Tie::Hash::NamedCapture=SCALAR(0x823fba8)) at -e line 1 during global destruction.
Tie::Hash::NamedCapture::DESTROY(Tie::Hash::NamedCapture=SCALAR(0x823fca8)) at -e line 1 during global destruction.
IO::File::DESTROY(IO::File=IO(0x823f078)) at -e line 1 during global destruction.
IO::File::DESTROY(IO::File=IO(0x823f0f8)) at -e line 1 during global destruction.
IO::File::DESTROY(IO::File=IO(0x823f178)) at -e line 1 during global destruction.


So apparently just creating UNIVERSAL::AUTOLOAD is enough to break %+, even if
AUTOLOAD is never called. But (for some reason) letting the parser see %+ early
makes things work as expected.

As far as I can tell this is broken in 5.12 and 5.10 but works in 5.14,
probably because Tie::Hash::NamedCapture is a real (XS) module there.

Any idea what's going on?


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.12.3:

Configured by mauke at Tue Aug  9 13:00:53 CEST 2011.

Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=2.6.37-gentoo-r4, archname=i686-linux
    uname='linux nora 2.6.37-gentoo-r4 #5 preempt sun may 8 03:58:55 cest 2011 i686 amd athlon(tm) 64 processor 3200+ authenticamd gnulinux '
    config_args='-de -Dprefix=/home/mauke/usr/perlbrew/perls/perl-5.12.3'
    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.4.5', 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 /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.12.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.12.2'
  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.12.3:
    /home/mauke/usr/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/i686-linux
    /home/mauke/usr/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3
    /home/mauke/usr/perlbrew/perls/perl-5.12.3/lib/5.12.3/i686-linux
    /home/mauke/usr/perlbrew/perls/perl-5.12.3/lib/5.12.3
    .

---
Environment for perl 5.12.3:
    HOME=/home/mauke
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_COLLATE=POSIX
    LD_LIBRARY_PATH=/home/mauke/usr/local/lib
    LOGDIR (unset)
    PATH=/home/mauke/usr/perlbrew/bin:/home/mauke/usr/perlbrew/perls/perl-5.12.3/bin:/home/mauke/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.5:/opt/sun-jdk-1.4.2.13/bin:/opt/sun-jdk-1.4.2.13/jre/bin:/opt/sun-jdk-1.4.2.13/jre/javaws:/opt/dmd/bin:/usr/games/bin
    PERLBREW_HOME=/home/mauke/.perlbrew
    PERLBREW_PATH=/home/mauke/usr/perlbrew/bin:/home/mauke/usr/perlbrew/perls/perl-5.12.3/bin
    PERLBREW_PERL=perl-5.12.3
    PERLBREW_ROOT=/home/mauke/usr/perlbrew
    PERLBREW_VERSION=0.27
    PERL_BADLANG (unset)
    PERL_UNICODE=SAL
    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