summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-11-25 14:58:42 +0000
committerNicholas Clark <nick@ccl4.org>2010-11-25 14:58:42 +0000
commitb19934fbc3c981a7e4bb888f0d6a20f926a0bc17 (patch)
treee15476f7230d021c936b5765e76a19a2f90800f1 /perl.c
parenta3179684398978e8bf4afba360eb728e4215d751 (diff)
downloadperl-b19934fbc3c981a7e4bb888f0d6a20f926a0bc17.tar.gz
Extend -d:foo=bar to make -d:-foo expand to C<no foo>, consistent with -M-foo
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index 438106e023..d2571a8bc1 100644
--- a/perl.c
+++ b/perl.c
@@ -3048,11 +3048,21 @@ Perl_moreswitches(pTHX_ const char *s)
/* The following permits -d:Mod to accepts arguments following an =
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
- const char *start = ++s;
- const char *const end = s + strlen(s);
- SV * const sv = newSVpvs("use Devel::");
+ const char *start;
+ const char *end;
+ SV *sv;
+
+ if (*++s == '-') {
+ ++s;
+ sv = newSVpvs("no Devel::");
+ } else {
+ sv = newSVpvs("use Devel::");
+ }
+
+ start = s;
+ end = s + strlen(s);
- /* We now allow -d:Module=Foo,Bar */
+ /* We now allow -d:Module=Foo,Bar and -d:-Module */
while(isALNUM(*s) || *s==':') ++s;
if (*s != '=')
sv_catpvn(sv, start, end - start);