This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixing PERL5OPT (was Re: Warnings, strict, and CPAN)
[perl5.git] / perl.c
diff --git a/perl.c b/perl.c
index 8d8dc1f..7dc4902 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1173,6 +1173,7 @@ print \"  \\@INC:\\n    @INC\\n\";");
            PL_tainting = TRUE;
        else {
            while (s && *s) {
+               char *d;
                while (isSPACE(*s))
                    s++;
                if (*s == '-') {
@@ -1180,11 +1181,18 @@ print \"  \\@INC:\\n    @INC\\n\";");
                    if (isSPACE(*s))
                        continue;
                }
+               d = s;
                if (!*s)
                    break;
                if (!strchr("DIMUdmw", *s))
                    Perl_croak(aTHX_ "Illegal switch in PERL5OPT: -%c", *s);
-               s = moreswitches(s);
+               while (++s && *s) {
+                   if (isSPACE(*s)) {
+                       *s++ = '\0';
+                       break;
+                   }
+               }
+               moreswitches(d);
            }
        }
     }