Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with qr// and multiline #4474

Closed
p5pRT opened this issue Oct 3, 2001 · 2 comments
Closed

Bug with qr// and multiline #4474

p5pRT opened this issue Oct 3, 2001 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 3, 2001

Migrated from rt.perl.org#7781 (status was 'resolved')

Searchable as RT7781$

@p5pRT
Copy link
Author

p5pRT commented Oct 3, 2001

From neilw@ActiveState.com

This bug has to do with qr//m not working correctly. Here are two one-liners
which demonstrate the problem​:

$ perl -wle '$a = "begin\nend"; $a =~ /^(begin)$/m; print $1'
begin
$ perl -wle '$a = "begin\nend"; $a =~ qr/^(begin)$/m; print $1'
Use of uninitialized value in print at -e line 1.

This means that somehow, the qr// operator, when combined with the 'm'
modifier, does not execute properly. It doesn't forget all about the 'm'
operator, though​:

$ perl -MData​::Dumper -we 'print Dumper qr/^(begin)$/m'
$VAR1 = qr/(?m-xis​:^(begin)$)/;

And even more strange, we can actually get the correct result by substituting
the more explicit regex back in for the old one​:

$ perl -wle '$a = "begin\nend"; $a =~ qr/(?m-xis​:^(begin)$)/; print $1'
begin

So there's only a problem with the trailing modifiers. This begs the question​:
does this affect any other modifiers? Apparently not, at least for the most
obvious ones​:

'i' modifier​:
$ perl -wle '$a = "BeGiN"; $a =~ qr/^(begin)$/i; print $1'
BeGiN

'x' modifier​:
$ perl -wle '$a = "begin"; $a =~ qr/^ ( begin ) $/x; print $1'
begin

's' modifier​:
$ perl -wle '$a = "begin\nend"; $a =~ qr/^(be.+nd)$/s; print $1'
begin
end

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.6.1:

Configured by daves at Mon Aug 20 15:53:26 PDT 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.2.17, archname=i686-linux-thread-multi
    uname='linux gimlet 2.2.17 #1 sun jun 25 09:24:41 est 2000 i686 unknown '
    config_args='-des -Dcc=gcc -Dcf_by=ActiveState -Dcf_email=ActivePerl@ActiveState.com -Uinstallusrbinperl -Ud_sigsetjmp -Dusethreads -Duseithreads -Dinc_version_list=5.6.0/$archname 5.6.0 -Dprefix=/usr/lang/perl/AP629'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='gcc', ccflags ='-DUSE_REENTRANT_API -D_POSIX_C_SOURCE=199506L -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-DUSE_REENTRANT_API -D_POSIX_C_SOURCE=199506L -D_REENTRANT -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.2 20000220 (Debian GNU/Linux)', 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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    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:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY


@INC for perl v5.6.1:
    /usr/lang/perl/AP629/lib/5.6.1/i686-linux-thread-multi
    /usr/lang/perl/AP629/lib/5.6.1
    /usr/lang/perl/AP629/lib/site_perl/5.6.1/i686-linux-thread-multi
    /usr/lang/perl/AP629/lib/site_perl/5.6.1
    /usr/lang/perl/AP629/lib/site_perl
    .


Environment for perl v5.6.1:
    HOME=/home/neilw
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/lang/perl/AP629/bin:/usr/lang/perl/AP626/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/neilw/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Nov 4, 2004

@smpeters - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant