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

Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
October 24, 2008 15:01
Subject:
Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400
Message ID:
4717.1224885657@chthon
Karl,

Thanks very much for the patch.

I confess guess I never *expected* "\400" to be "\x{100}", 
but rather "\x{20}0".   

However, I'm a bit concerned about perl -0777, as it's documented to 

    The special value 00 will cause Perl to slurp files in paragraph 
    mode.  The value 0777 will cause Perl to slurp files whole because 
    there is no legal byte with that value.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    Either put all the switches after the 32-character boundary 
    (if applicable), or replace the use of B<-0>I<digits> by 
    C<BEGIN{ $/ = "\0digits"; }>.
                   ^^^^^^^^

While your patch doesn't seem to affect that, it might lead one to
question differing behaviors in different places.

    regexp: \777 means naughty
    string: \777 means... um what?
    CLI:    \777 means undef $/

And so I wonder what's to be done about that.  

But perhaps I under-understand?

--tom

    --- regcomp.c.orig      2008-10-18 12:16:42.000000000 -0600
    +++ regcomp.c   2008-10-24 10:22:24.000000000 -0600
    @@ -7417,6 +7417,7 @@
                                  I32 flags = 0;
                                STRLEN numlen = 3;
                                ender = grok_oct(p, &numlen, &flags, NULL);
    +                           if (ender > 0xff) RExC_utf8 = 1;
                                p += numlen;
                            }
                            else {
    --- t/op/re_tests.orig  2008-09-22 14:42:42.000000000 -0600
    +++ t/op/re_tests       2008-10-24 10:51:35.000000000 -0600
    @@ -1357,3 +1357,8 @@
      /^\s*i.*?o\s*$/s      io\n io y       -       -
      # As reported in #59168 by Father Chrysostomos:
      /(.*?)a(?!(a+)b\2c)/  baaabaac        y       $&-$1   baa-ba
    +
    +# #59342
    +/\377/ \377    y       $&      \377
    +/\400/ \400    y       $&      \400
    +/\777/ \777    y       $&      \777


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