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

[ID 20010815.012] Unfortunate interaction between -0 cmd line arg& (??{CODE}) regex

Thread Next
From:
Eric Promislow
Date:
August 15, 2001 20:45
Subject:
[ID 20010815.012] Unfortunate interaction between -0 cmd line arg& (??{CODE}) regex
Message ID:
200108160341.f7G3ftB19670@smtp3.ActiveState.com
This is a bug report for perl from ericp@ActiveState.com,
generated with the help of perlbug 1.26 running under perl 5.006.


-----------------------------------------------------------------
[Please enter your report here]

I encountered this bug when trying to debug a program with the -0
option (which was set by accident).  It turns out that the 
following code will only compile with either -012 set (on both
Linux and Windows, Windows using Active Perl binary build 628),
or -0 not given.  Changing $/ to anything other than "\n" in
a BEGIN block before the sub will also trigger the compile-time
error.

Command-line:  no args needed

Source:
=================================================================
#!/usr/bin/perl -0

BEGIN { print "before sub\n" }

sub unbalanced {
    $balanced_brace_re ||= /(??{ $balanced_brace_re })/;
    return 'ab{cd{' !~ m/$balanced_brace_re/;
}

BEGIN { print "after sub\n" }  # not reached
=================================================================

[Please do not change anything below this line]
-----------------------------------------------------------------

---
This perlbug was built using Perl 5.00503 - Thu Aug 10 15:31:56 EDT 2000
It is being executed now by  Perl 5.006 - Wed Aug 30 16:29:46 PDT 2000.

Site configuration information for perl 5.006:

Configured by build at Wed Aug 30 16:29:46 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.15, archname=i686-linux-thread-multi
    uname='linux churn.activestate.com 2.2.15 #1 smp thu may 25 03:22:16 pdt 2000 i686 unknown '
    config_args='-des -Dcc=gcc -Dcf_email=ActivePerl@ActiveState.com -Uinstallusrbinperl -Dusethreads -Duseithreads -Dprefix=/usr/local/ActivePerl-5.6'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-D_REENTRANT -fno-strict-aliasing'
    ccflags ='-D_REENTRANT -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lpthread -lc -lposix -lcrypt
    libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.006:
    /usr/local/ActivePerl-5.6/lib/5.6.0/i686-linux-thread-multi
    /usr/local/ActivePerl-5.6/lib/5.6.0
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0/i686-linux-thread-multi
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0
    /usr/local/ActivePerl-5.6/lib/site_perl
    .

---
Environment for perl 5.006:
    HOME=/home/ericp
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/X11R6/bin:/usr/local/bin:/home/ericp/bin
    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