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

[perl #33906] Missing \\ in perlre

Thread Next
From:
Andrew
Date:
January 23, 2005 13:05
Subject:
[perl #33906] Missing \\ in perlre
Message ID:
rt-3.0.11-33906-106339.17.5527961922343@perl.org
# New Ticket Created by  Andrew 
# Please include the string:  [perl #33906]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=33906 >


This is a bug report for perl from andrew@paivi.local,
generated with the help of perlbug 1.35 running under perl v5.8.4.


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

In perlre there is a section entitled "Creating custom RE
engines". The sample code given maps \\ to \ inside regular
expressions and thus prevents you from using \\ to represent a
literal \. I think this is unintentional and a patch is included
below.

It might also be useful to put in some explanation as to why the
\\ is required at all as I don't think it is immeadiately clear.
That said I'm not volunteering to do the writing just now :-/

Thanks,

Andrew

--- perlre.pod.orig	Tue Jan 13 21:46:44 2004
+++ perlre.pod	Sun Jan 23 13:31:26 2005
@@ -1288,7 +1288,7 @@

      sub invalid { die "/$_[0]/: invalid escape '\\$_[1]'"}

-    my %rules = ( '\\' => '\\',
+    my %rules = ( '\\' => '\\\\',
  		  'Y|' => qr/(?=\S)(?<!\S)|(?!\S)(?<=\S)/ );
      sub convert {
        my $re = shift;


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=docs
     severity=medium
---
Site configuration information for perl v5.8.4:

Configured by andrew at Thu Aug 26 14:31:08 BST 2004.

Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
   Platform:
     osname=darwin, osvers=7.5.0, archname=darwin-2level
     uname='darwin paivi.local 7.5.0 darwin kernel version 7.5.0: thu  
aug 5 19:26:16 pdt 2004; root:xnuxnu-517.7.21.obj~3release_ppc power  
macintosh powerpc '
     config_args='-des -Dprefix=/opt/local  
-Dccflags=-I'/opt/local/include' -Dldflags=-L/opt/local/lib  
-Dvendorprefix=/opt/local'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=undef use5005threads=undef 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 ='-I/opt/local/include -pipe -fno-common  
-DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing  
-I/opt/local/include',
     optimize='-Os',
     cppflags='-no-cpp-precomp -I/opt/local/include -pipe -fno-common  
-DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing  
-I/opt/local/include'
     ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build  
1666)', 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/opt/local/lib -L/usr/local/lib'
     libpth=/usr/local/lib /opt/local/lib /usr/lib
     libs=-ldbm -ldl -lm -lc
     perllibs=-ldl -lm -lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false,  
libperl=libperl.a
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-L/opt/local/lib -bundle -undefined  
dynamic_lookup -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.4:
     /opt/local/lib/perl5/5.8.4/darwin-2level
     /opt/local/lib/perl5/5.8.4
     /opt/local/lib/perl5/site_perl/5.8.4/darwin-2level
     /opt/local/lib/perl5/site_perl/5.8.4
     /opt/local/lib/perl5/site_perl
     /opt/local/lib/perl5/vendor_perl/5.8.4/darwin-2level
     /opt/local/lib/perl5/vendor_perl/5.8.4
     /opt/local/lib/perl5/vendor_perl
     .

---
Environment for perl v5.8.4:
     DYLD_LIBRARY_PATH (unset)
     HOME=/Users/andrew
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
      
PATH=/Users/andrew/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/ 
opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools
     PERL_BADLANG (unset)
     SHELL=/bin/tcsh


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