From: Randy J. Ray <rjray@redhat.com>
Date: Mon, 7 Aug 2000 19:12:25 +0000 (-0700)
Subject: Patch against 5.6.0 to allow "-d:Module=arg,arg,arg"
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=70c94a1962e4ec78d69c2158c32b643ceb04ff36;p=p5sagit%2Fp5-mst-13.2.git

Patch against 5.6.0 to allow "-d:Module=arg,arg,arg"
Message-Id: <200008080212.TAA12784@tzimisce.soma.redhat.com>

p4raw-id: //depot/perl@6547
---

diff --git a/perl.c b/perl.c
index ed8befa..aa80993 100644
--- a/perl.c
+++ b/perl.c
@@ -2060,9 +2060,25 @@ Perl_moreswitches(pTHX_ char *s)
     case 'd':
 	forbid_setid("-d");
 	s++;
-	if (*s == ':' || *s == '=')  {
-	    my_setenv("PERL5DB", Perl_form(aTHX_ "use Devel::%s;", ++s));
+	/* The following permits -d:Mod to accepts arguments following an =
+	   in the fashion that -MSome::Mod does. */
+	if (*s == ':' || *s == '=') {
+	    char *start;
+	    SV *sv;
+	    sv = newSVpv("use Devel::", 0);
+	    start = ++s;
+	    /* We now allow -d:Module=Foo,Bar */
+	    while(isALNUM(*s) || *s==':') ++s;
+	    if (*s != '=')
+		sv_catpv(sv, start);
+	    else {
+		sv_catpvn(sv, start, s-start);
+		sv_catpv(sv, " split(/,/,q{");
+		sv_catpv(sv, ++s);
+		sv_catpv(sv,    "})");
+	    }
 	    s += strlen(s);
+	    my_setenv("PERL5DB", SvPV(sv, PL_na));
 	}
 	if (!PL_perldb) {
 	    PL_perldb = PERLDB_ALL;
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index e105b00..98ab39c 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -284,11 +284,15 @@ be skipped.
 
 runs the program under the Perl debugger.  See L<perldebug>.
 
-=item B<-d:>I<foo>
+=item B<-d:>I<foo[=bar,baz]>
 
 runs the program under the control of a debugging, profiling, or
 tracing module installed as Devel::foo. E.g., B<-d:DProf> executes
-the program using the Devel::DProf profiler.  See L<perldebug>.
+the program using the Devel::DProf profiler.  As with the B<-M>
+flag, options may be passed to the Devel::foo package where they
+will be received and interpreted by the Devel::foo::import routine.
+The comma-separated list of options must follow a C<=> character.
+See L<perldebug>.
 
 =item B<-D>I<letters>