Change 18843 by [EMAIL PROTECTED] on 2003/03/06 21:59:02

        Make the -A switch work without an assertion name.
        by Salvador Fandi�o.

Affected files ...

... //depot/perl/perl.c#471 edit
... //depot/perl/t/run/switch_A.t#2 edit

Differences ...

==== //depot/perl/perl.c#471 (text) ====
Index: perl/perl.c
--- perl/perl.c#470~18801~      Sun Mar  2 07:24:22 2003
+++ perl/perl.c Thu Mar  6 13:59:02 2003
@@ -2332,17 +2332,17 @@
        return s;
     case 'A':
        forbid_setid("-A");
+       if (!PL_preambleav)
+           PL_preambleav = newAV();
        if (*++s) {
-           SV *sv=newSVpv("use assertions::activate split(/,/,q{",0);
+           SV *sv = newSVpvn("use assertions::activate split(/,/,q{",37);
            sv_catpv(sv,s);
            sv_catpv(sv,"})");
            s+=strlen(s);
-           if(!PL_preambleav)
-               PL_preambleav = newAV();
            av_push(PL_preambleav, sv);
        }
        else
-           Perl_croak(aTHX_ "No space allowed after -A");
+           av_push(PL_preambleav, newSVpvn("use assertions::activate",24));
        return s;
     case 'M':
        forbid_setid("-M");     /* XXX ? */

==== //depot/perl/t/run/switch_A.t#2 (xtext) ====
Index: perl/t/run/switch_A.t
--- perl/t/run/switch_A.t#1~18747~      Tue Feb 18 15:47:06 2003
+++ perl/t/run/switch_A.t       Thu Mar  6 13:59:02 2003
@@ -7,7 +7,7 @@
 }
 
 BEGIN {
-    plan(4);
+    plan(5);
 }
 
 #1
@@ -29,3 +29,8 @@
 fresh_perl_is('sub cm : assertion { "ok" }; use assertions Hello; print cm()',
              '0',
              { switches => ['-ANoH..o'] }, '-ANoH..o');
+
+#5
+fresh_perl_is('sub cm : assertion { "ok" }; use assertions Hello; print cm()',
+             'ok',
+             { switches => ['-A'] }, '-A');
End of Patch.

Reply via email to