develooper Front page | perl.perl5.porters | Postings from January 2008

Bugs in extended regexp features

Thread Next
From:
Moritz Lenz
Date:
January 5, 2008 08:35
Subject:
Bugs in extended regexp features
Message ID:
477FACED.4000505@casella.verplant.org
With my shiny perl 5.10.0 on Linux I observed some bugs with extended
regexp features. I know they're "experimental", but perhaps the reports
help you anyway.

=== bug 1 ===

$ perl5.10.0 -Mre=eval -wlE 'my $re = qr/(\w+)/;"foo" =~ m/($re)(?{say
$^N})/'
Can't locate object method "say" via package "foo" (perhaps you forgot
to load "foo"?) at (re_eval 1) line 1.

I can use say() in normal code, and inside the (?{...}) group print()
instead of say() works.
If I don't interpolate $re but use m/(\w+)(?{say $^N})/, it works as well.

=== bug 2 ===

#!/usr/bin/env perl5.10.0
use strict;
use warnings;
use re 'eval';
use 5.010;

my $nested_tags;

$nested_tags = qr{
    <
        (\w+)
        (?{print "Match so far: [$&]\n";})
        (?{print defined($^N) ? "ok: $^N\n" : "undef\n";})
    >
        (??{$nested_tags})*
        </\s* \w+ \s*>
}x;

say "ok" if  '<bla><blubb></blubb></bla>' =~ m/^$nested_tags$/;
__END__
Match so far: [<bla]
ok: bla
Match so far: [<bla><blubb]
undef
ok

Note that the fourth line of the output, 'undef', should be 'ok; blubb'.

Output of perl5.10.0 -V  follows.

Cheers,
Moritz

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.6.23.1, archname=i486-linux-gnu-thread-multi
    uname='linux trudi 2.6.23.1 #15 smp mon nov 5 02:32:55 cet 2007 i686
gnulinux '
    config_args='-de -Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i486-linux-gnu'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing
-pipe -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20061115 (prerelease) (Debian
4.1.1-21)', 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 =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.3.6.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.6'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
                        USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
  Built under linux
  Compiled at Dec 18 2007 19:08:16
  %ENV:
    PERL6LIB="/home/moritz/pugs/blib6/lib"
  @INC:
    /usr/local/lib/perl5/5.10.0/i486-linux-gnu-thread-multi
    /usr/local/lib/perl5/5.10.0
    /usr/local/lib/perl5/site_perl/5.10.0/i486-linux-gnu-thread-multi
    /usr/local/lib/perl5/site_perl/5.10.0
    .




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