summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorSalvador FandiƱo <sfandino@yahoo.com>2002-11-30 17:24:09 +0000
committerhv <hv@crypt.org>2003-02-16 13:55:10 +0000
commit06492da604676b8820ba5623ac813ceec4f48731 (patch)
tree51a6bda59973daccf9c0377e9639e90650598088 /perl.c
parented25273444c5542e4865fbe422e026b78ba33b80 (diff)
downloadperl-06492da604676b8820ba5623ac813ceec4f48731.tar.gz
add support for assertions. Updated form of:
Subject: Re: Did the assertion patch/feature submission get overlooked? Message-ID: <3DE8F439.50402@yahoo.com> p4raw-id: //depot/perl@18727
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index 7156ba6ec5..4893762496 100644
--- a/perl.c
+++ b/perl.c
@@ -1024,6 +1024,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
case 'W':
case 'X':
case 'w':
+ case 'A':
if ((s = moreswitches(s)))
goto reswitch;
break;
@@ -1235,7 +1236,7 @@ print \" \\@INC:\\n @INC\\n\";");
d = s;
if (!*s)
break;
- if (!strchr("DIMUdmtw", *s))
+ if (!strchr("DIMUdmtwA", *s))
Perl_croak(aTHX_ "Illegal switch in PERL5OPT: -%c", *s);
while (++s && *s) {
if (isSPACE(*s)) {
@@ -2319,6 +2320,20 @@ Perl_moreswitches(pTHX_ char *s)
}
}
return s;
+ case 'A':
+ forbid_setid("-A");
+ if (*++s) {
+ SV *sv=newSVpv("use assertions::activate split(/,/,q{",0);
+ 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");
+ return s;
case 'M':
forbid_setid("-M"); /* XXX ? */
/* FALL THROUGH */
@@ -3265,6 +3280,8 @@ Perl_init_debugger(pTHX)
sv_setiv(PL_DBtrace, 0);
PL_DBsignal = GvSV((gv_fetchpv("signal", GV_ADDMULTI, SVt_PV)));
sv_setiv(PL_DBsignal, 0);
+ PL_DBassertion = GvSV((gv_fetchpv("assertion", GV_ADDMULTI, SVt_PV)));
+ sv_setiv(PL_DBassertion, 0);
PL_curstash = ostash;
}