In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fc46f0f6acf947702bfc9ac32e05b1f4e8f4c720?hp=f0c5aa00eeb992584d6996af147c4c51fe7a6540>
- Log ----------------------------------------------------------------- commit fc46f0f6acf947702bfc9ac32e05b1f4e8f4c720 Author: Father Chrysostomos <[email protected]> Date: Sun Jul 26 10:30:00 2009 +0100 perldelta entry noting when -C is now allowed on the #! line. M pod/perl5110delta.pod commit 4ba71d51f72efb2af8dc9748dd62219261f2e1fd Author: Father Chrysostomos <[email protected]> Date: Sun Jul 26 10:27:42 2009 +0100 Allow -C on the #! line when it is identical to -C on the command line. Change from dieing whenever -C is seen on the #! line, to dieing only when it differs from that on the command line, or was not specified on the command line. M pod/perldiag.pod M pod/perlrun.pod M t/run/switchC.t M toke.c ----------------------------------------------------------------------- Summary of changes: pod/perl5110delta.pod | 7 +++++++ pod/perldiag.pod | 11 +++++++++-- pod/perlrun.pod | 6 +++--- t/run/switchC.t | 6 +++++- toke.c | 10 +++++++++- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/pod/perl5110delta.pod b/pod/perl5110delta.pod index c7cb8ae..d7eb6dc 100644 --- a/pod/perl5110delta.pod +++ b/pod/perl5110delta.pod @@ -209,6 +209,13 @@ kill process "0", which would terminate the current process group on POSIX systems. Since process identifiers are always integers, killing a non-numeric process is now fatal. +=item C<-C> on the shebang line is once more permitted + +if it is also specified on the command line. C<-C> on the shebang line used +to be a silent no-op I<if> it was not also on the command line, so perl +5.10.0 disallowed it, which broke some scripts. Now perl checks whether it +is also on the command line and only dies if it is not. + =back =head1 New or Changed Diagnostics diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 1775163..2623010 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4196,8 +4196,15 @@ system call to call, silly dilly. =item Too late for "-%s" option (X) The #! line (or local equivalent) in a Perl script contains the -B<-M>, B<-m> or B<-C> option. This is an error because those options -are not intended for use inside scripts. Use the C<use> pragma instead. +B<-M>, B<-m> or B<-C> option. + +In the case of B<-M> and B<-m>, this is an error because those options are +not intended for use inside scripts. Use the C<use> pragma instead. + +The B<-C> option only works if it is specified on the command line as well +(with the same sequence of letters or numbers following). Either specify +this option on the command line, or, if your system supports it, make your +script executable and run it directly instead of passing it to perl. =item Too late to run %s block diff --git a/pod/perlrun.pod b/pod/perlrun.pod index c3b30c8..994aecb 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -342,10 +342,10 @@ that enabled the use of Unicode-aware "wide system call" Win32 APIs. This feature was practically unused, however, and the command line switch was therefore "recycled".) -B<Note:> Since perl 5.10.0, the -C option can no longer be used -on the #! line. It wasn't working there anyway, since the standard streams +B<Note:> Since perl 5.10.1, if the -C option is used on the #! line, it +must be specified on the command line as well, since the standard streams are already set up at this point in the execution of the perl interpreter. -You can use binmode() instead to get the desired behaviour. +You can also use binmode() to set the encoding of an I/O stream. =item B<-c> X<-c> diff --git a/t/run/switchC.t b/t/run/switchC.t index 41dba49..9e52ad3 100644 --- a/t/run/switchC.t +++ b/t/run/switchC.t @@ -13,7 +13,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan(tests => 6); +plan(tests => 7); my $r; @@ -59,3 +59,7 @@ $r = runperl( switches => [ '-CA', '-w' ], args => [ chr(256) ] ); like( $r, qr/^256(?:\r?\n)?$/s, '-CA: @ARGV' ); +$r = runperl( switches => [ '-CS', '-w' ], + prog => "#!perl -CS\nprint chr(256)", + stderr => 1, ); +like( $r, qr/^$b(?:\r?\n)?$/s, '#!perl -C' ); diff --git a/toke.c b/toke.c index 885027e..56e9620 100644 --- a/toke.c +++ b/toke.c @@ -3999,7 +3999,15 @@ Perl_yylex(pTHX) const char *d1 = d; do { - if (*d1 == 'M' || *d1 == 'm' || *d1 == 'C') { + bool baduni = FALSE; + if (*d1 == 'C') { + const char *d2 = d1; + d2++; + parse_unicode_opts( (const char **)&d2 ) + == PL_unicode + || (baduni = TRUE); + } + if (baduni || *d1 == 'M' || *d1 == 'm') { const char * const m = d1; while (*d1 && !isSPACE(*d1)) d1++; -- Perl5 Master Repository
