Change 33822 by [EMAIL PROTECTED] on 2008/05/11 15:10:32

        Subject: [PATCH] Handle PL_minus_E before PL_minus_{n,p}.
        From: Florian Ragwitz <[EMAIL PROTECTED]>
        Date: Sun, 11 May 2008 07:51:18 +0200
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/t/run/switches.t#25 edit
... //depot/perl/toke.c#820 edit

Differences ...

==== //depot/perl/t/run/switches.t#25 (text) ====
Index: perl/t/run/switches.t
--- perl/t/run/switches.t#24~33407~     2008-03-01 23:24:18.000000000 -0800
+++ perl/t/run/switches.t       2008-05-11 08:10:32.000000000 -0700
@@ -11,7 +11,7 @@
 
 BEGIN { require "./test.pl"; }
 
-plan(tests => 68);
+plan(tests => 69);
 
 use Config;
 
@@ -346,3 +346,9 @@
     switches   => [ '-E', '"given(undef) {when(undef) { say q(Hello, 
world!)"}}']
 );
 is( $r, "Hello, world!\n", "-E given" );
+
+$r = runperl(
+    switches    => [ '-nE', q('} END { say q/affe/') ],
+    stdin       => 'zomtek',
+);
+is( $r, "affe\n", '-E works outside of the block created by -n' );

==== //depot/perl/toke.c#820 (text) ====
Index: perl/toke.c
--- perl/toke.c#819~33437~      2008-03-04 11:59:20.000000000 -0800
+++ perl/toke.c 2008-05-11 08:10:32.000000000 -0700
@@ -3688,6 +3688,9 @@
                sv_free((SV*)PL_preambleav);
                PL_preambleav = NULL;
            }
+           if (PL_minus_E)
+               sv_catpvs(PL_linestr,
+                         "use feature ':5." STRINGIFY(PERL_VERSION) "';");
            if (PL_minus_n || PL_minus_p) {
                sv_catpvs(PL_linestr, "LINE: while (<>) {");
                if (PL_minus_l)
@@ -3719,9 +3722,6 @@
                        sv_catpvs(PL_linestr,"our @F=split(' ');");
                }
            }
-           if (PL_minus_E)
-               sv_catpvs(PL_linestr,
-                         "use feature ':5." STRINGIFY(PERL_VERSION) "';");
            sv_catpvs(PL_linestr, "\n");
            PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = 
SvPVX(PL_linestr);
            PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
End of Patch.

Reply via email to