In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/d4a59e542ce03bfe18bcffde552ee3abd4322b89?hp=e2941eb00290cb2fcd0e0ca3f614f82202be65f7>

- Log -----------------------------------------------------------------
commit d4a59e542ce03bfe18bcffde552ee3abd4322b89
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Sep 26 17:36:51 2010 -0700

    #!perl -C -w dies
    
    parse_unicode_opts expects to end on '\0'. So #!perl -C -w causes an
    ‘Unknown Unicode option letter ' '’ error. The attached
    patch fixes it.
-----------------------------------------------------------------------

Summary of changes:
 pod/perldelta.pod |    5 +++++
 t/run/switchC.t   |   15 ++++++++++++++-
 util.c            |   12 ++++++++++--
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 48003fe..d549441 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -542,6 +542,11 @@ L<[perl 
#76814]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=76814>.
 This bug was introduced in an earlier 5.13 release, and does not affect
 perl 5.12.
 
+=item *
+
+The C<-C> option can now be followed by other options
+L<[perl #72434]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=72434>.
+
 =back
 
 =head1 Known Problems
diff --git a/t/run/switchC.t b/t/run/switchC.t
index 213bdbc..65b5eab 100644
--- a/t/run/switchC.t
+++ b/t/run/switchC.t
@@ -18,7 +18,7 @@ BEGIN {
 
 BEGIN { require "./test.pl"; }
 
-plan(tests => 9);
+plan(tests => 11);
 
 my $r;
 
@@ -69,6 +69,19 @@ $r = runperl( switches => [ '-CS', '-w' ],
               stderr   => 1, );
 like( $r, qr/^$b(?:\r?\n)?$/s, '#!perl -C' );
 
+$r = runperl( switches => [ '-CS' ],
+             progs    => [ '#!perl -CS -w', 'print chr(256), !!$^W'],
+              stderr   => 1, );
+like( $r, qr/^${b}1(?:\r?\n)?$/s, '#!perl -C followed by another switch' );
+
+$r = runperl( switches => [ '-CS' ],
+             progs    => [ '#!perl -C7 -w', 'print chr(256), !!$^W'],
+              stderr   => 1, );
+like(
+  $r, qr/^${b}1(?:\r?\n)?$/s,
+ '#!perl -C<num> followed by another switch'
+);
+
 $r = runperl( switches => [ '-CA', '-w' ],
              progs    => [ '#!perl -CS', 'print chr(256)' ],
               stderr   => 1, );
diff --git a/util.c b/util.c
index 8bd57fc..bce196a 100644
--- a/util.c
+++ b/util.c
@@ -5719,8 +5719,11 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
            opt = (U32) atoi(p);
            while (isDIGIT(*p))
                p++;
-           if (*p && *p != '\n' && *p != '\r')
+           if (*p && *p != '\n' && *p != '\r') {
+            if(isSPACE(*p)) goto the_end_of_the_opts_parser;
+            else
                 Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", *p);
+           }
        }
        else {
            for (; *p; p++) {
@@ -5746,9 +5749,12 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
                 case PERL_UNICODE_UTF8CACHEASSERT:
                      opt |= PERL_UNICODE_UTF8CACHEASSERT_FLAG; break;
                 default:
-                     if (*p != '\n' && *p != '\r')
+                     if (*p != '\n' && *p != '\r') {
+                       if(isSPACE(*p)) goto the_end_of_the_opts_parser;
+                       else
                          Perl_croak(aTHX_
                                     "Unknown Unicode option letter '%c'", *p);
+                     }
                 }
            }
        }
@@ -5756,6 +5762,8 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
   else
        opt = PERL_UNICODE_DEFAULT_FLAGS;
 
+  the_end_of_the_opts_parser:
+
   if (opt & ~PERL_UNICODE_ALL_FLAGS)
        Perl_croak(aTHX_ "Unknown Unicode option value %"UVuf,
                  (UV) (opt & ~PERL_UNICODE_ALL_FLAGS));

--
Perl5 Master Repository

Reply via email to