List Info

Thread: /x treated inconsistently




/x treated inconsistently
user name
2007-09-22 10:05:59
# New Ticket Created by  Chris Dolan 
# Please include the string:  [perl #45667]
# in the subject line of all future correspondence about
this issue. 
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45667 >


This is a bug report for perl from cdolancpan.org,
generated with the help of perlbug 1.35 running under perl
v5.8.6.


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

These should output the same value, but instead the first
one emits  
"f" and the second one undef.

       my $qr = qr/(f)/;
       print "#f" =~ m/[#](f)/x;
       print "#f" =~ m/[#]$qr/x;

This is more revealing:

       print qr/[#]$qr/x;

yields:

       (?x-ism:[#]$qr
       )

So, it appears that [#] is disabling interpolation for
variables that  
follow, but then still treating the content as regexp. 
Clearly, it's  
not *just* treating it as a comment, or the remaining qr/[/
would be  
a syntax error.

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

Configured by root at Thu Nov  2 10:35:22 PST 2006.

Summary of my perl5 (revision 5 version 8 subversion 6)
configuration:
   Platform:
     osname=darwin, osvers=8.0,
archname=darwin-thread-multi-2level
     uname='darwin b07.apple.com 8.0 darwin kernel version
8.3.0: mon  
oct 3 20:04:04 pdt 2005; rootnu-79
2.6.22.obj~2release_ppc power  
macintosh powerpc '
     config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe 
- 
Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef
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 ='-g -pipe -fno-common -DPERL_DARWIN
-no-cpp- 
precomp -fno-strict-aliasing -I/usr/local/include',
     optimize='-Os',
     cppflags='-no-cpp-precomp -g -pipe -fno-common
-DPERL_DARWIN -no- 
cpp-precomp -fno-strict-aliasing -I/usr/local/include'
     ccversion='', gccversion='3.3 20030304 (Apple Computer,
Inc.  
build 1819)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8,
byteorder=4321
     d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=8
     ivtype='long', ivsize=4, 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
='-L/usr/ 
local/lib'
     libpth=/usr/local/lib /usr/lib
     libs=-ldbm -ldl -lm -lc
     perllibs=-ldl -lm -lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true,  
libperl=libperl.dylib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef,
ccdlflags=' '
     cccdlflags=' ', lddlflags='-bundle -undefined
dynamic_lookup -L/ 
usr/local/lib'

Locally applied patches:
     23953 - fix for File::Path::rmtree CAN-2004-0452
security issue
     33990 - fix for setuid perl security issues
     SPRINTF0 - fixes for sprintf formatting issues -
CVE-2005-3962

---
INC
for perl v5.8.6:
    
/Users/chris/perl/lib/perl5/site_perl/5.8.6/darwin-thread- 
multi-2level
     /Users/chris/perl/lib/perl5/site_perl/5.8.6
     /Users/chris/perl/lib/perl5/site_perl
     /Users/chris/perl/lib/perl5/darwin-thread-multi-2level
     /Users/chris/perl/lib/perl5
    
/Users/chris/perl/lib/perl5-core/5.8.6/darwin-thread-multi-2
level
     /Users/chris/perl/lib/perl5-core/5.8.6
     /Users/chris/perl/lib/perl5-core
     /Users/chris/perl/lib/darwin-thread-multi-2level
     /Users/chris/perl/lib
    
/Users/chris/perl/System/Library/Perl/5.8.6/darwin-thread- 
multi-2level
     /Users/chris/perl/System/Library/Perl/5.8.6
     /Users/chris/perl/System/Library/Perl
    
/Users/chris/perl/System/Library/Perl/5.8.6/darwin-thread- 
multi-2level
     /Users/chris/perl/System/Library/Perl/5.8.6
     /sw/lib/perl5/5.8.6/darwin-thread-multi-2level
     /sw/lib/perl5/5.8.6
     /sw/lib/perl5/darwin-thread-multi-2level
     /sw/lib/perl5
     /sw/lib/perl5/darwin
     /System/Library/Perl/5.8.6/darwin-thread-multi-2level
     /System/Library/Perl/5.8.6
     /Library/Perl/5.8.6/darwin-thread-multi-2level
     /Library/Perl/5.8.6
     /Library/Perl
     /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
     /Network/Library/Perl/5.8.6
     /Network/Library/Perl
    
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level

     /System/Library/Perl/Extras/5.8.6
     /Library/Perl/5.8.1
     .

---
Environment for perl v5.8.6:
     DYLD_LIBRARY_PATH (unset)
     HOME=/Users/chris
     LANG (unset)
     LANGUAGE (unset)
     LC_ALL=C
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
    
PATH=/Users/chris/perl/bin:/Users/chris/perl/usr/bin:/Users/

chris/perl/script:/sw/bin:/sw/sbin:.:/Users/chris/bin:/usr/X
11R6/bin:/ 
bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools
    
PERL5LIB=/Users/chris/perl/lib/perl5/site_perl:/Users/chris/
perl/ 
lib/perl5:/Users/chris/perl/lib/perl5-core:/Users/chris/perl
/lib:/ 
Users/chris/perl/System/Library/Perl:/Users/chris/perl/Syste
m/Library/ 
Perl/5.8.6:/sw/lib/perl5:/sw/lib/perl5/darwin
     PERL_BADLANG (unset)
     PERL_CRITIC_CACHE=1
     SHELL=/bin/tcsh
	


Re: /x treated inconsistently
user name
2007-09-23 07:53:56
On Sat, Sep 22, 2007 at 08:05:59AM -0700, Chris Dolan
wrote:
> These should output the same value, but instead the
first one emits  
> "f" and the second one undef.
> 
>        my $qr = qr/(f)/;
>        print "#f" =~ m/[#](f)/x;
>        print "#f" =~ m/[#]$qr/x;
> 
> This is more revealing:
> 
>        print qr/[#]$qr/x;
> 
> yields:
> 
>        (?x-ism:[#]$qr
>        )
> 
> So, it appears that [#] is disabling interpolation for
variables that  
> follow, but then still treating the content as regexp. 
Clearly, it's  
> not *just* treating it as a comment, or the remaining
qr/[/ would be  
> a syntax error.

Hmm, looks like the tokenizer isn't smart enough to know to
ignore #'s
when within a character class. S_scan_const() needs to be
made even more
scary than it already is. Probably a post 5.10.0 job.


-- 
"You may not work around any technical limitations in
the software"
    -- Windows Vista license

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )