develooper Front page | perl.perl5.porters | Postings from March 2013

[perl #117061] meta character in //x comment

Thread Previous | Thread Next
From:
Tokuhiro Matsuno
Date:
March 6, 2013 06:06
Subject:
[perl #117061] meta character in //x comment
Message ID:
rt-3.6.HEAD-28177-1362549969-737.117061-75-0@perl.org
# New Ticket Created by  "Tokuhiro Matsuno" 
# Please include the string:  [perl #117061]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117061 >



This is a bug report for perl from tokuhirom@gmail.com,
generated with the help of perlbug 1.39 running under perl 5.17.7.


-----------------------------------------------------------------
[Please describe your issue here]

In this code, Perl5 does not replace anything without any warnings.
It makes confusion for //x users.

> use 5.014000;
>
> my $s = 'gfx';
> $s =~ s![
>     gfx # Fuji Gorou]
> ]!SurCen!gx;
> say $s;

Following ruby code output warnings.
>puts "gfx".gsub(/[
>   gfx # Fuji Gorou]
> ]/x, 'SurCen')

Output:
> hoge.rb:3: warning: regexp has `]' without escape
> gfx

I guess, perl5 should output warnings, or ignore meta characters in regexp comment in //x mode.

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

Configured by tokuhirom at Tue Jan 15 09:48:05 JST 2013.

Summary of my perl5 (revision 5 version 17 subversion 7) configuration:
   
  Platform:
    osname=linux, osvers=3.2.0-23-generic, archname=x86_64-linux
    uname='linux www4071uf 3.2.0-23-generic #36-ubuntu smp tue apr 10 20:39:51 utc 2012 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dprefix=/home/tokuhirom/.plenv/versions/5.17.7 -de -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.15'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.17.7:
    /home/tokuhirom/.plenv/versions/5.17.7/lib/perl5/site_perl/5.17.7/x86_64-linux
    /home/tokuhirom/.plenv/versions/5.17.7/lib/perl5/site_perl/5.17.7
    /home/tokuhirom/.plenv/versions/5.17.7/lib/perl5/5.17.7/x86_64-linux
    /home/tokuhirom/.plenv/versions/5.17.7/lib/perl5/5.17.7
    .

---
Environment for perl 5.17.7:
    HOME=/home/tokuhirom
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_ALL=en_US.UTF-8
    LC_CTYPE=UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/tokuhirom/.plenv/versions/5.17.7/bin/:/home/tokuhirom/.plenv/shims:/home/tokuhirom/.plenv/bin/:/home/tokuhirom/.rbenv/shims:/home/tokuhirom/.rbenv/bin:/home/tokuhirom/dotfiles/local/bin/:/home/tokuhirom/bin:/home/tokuhirom/local/bin/:/usr/local/mysql/bin/:/usr/local/bin/:/home/tokuhirom/.plenv/shims:/home/tokuhirom/.plenv/bin/:/home/tokuhirom/.rbenv/shims:/home/tokuhirom/.rbenv/bin:/home/tokuhirom/dotfiles/local/bin/:/home/tokuhirom/bin:/home/tokuhirom/local/bin/:/usr/local/mysql/bin/:/usr/local/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
    PERL_AUTOINSTALL=--defaultdeps
    PERL_BADLANG=0
    PERL_CPANM_OPT=--notest --no-man-pages
    SHELL=/usr/bin/zsh


Thread Previous | 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