develooper Front page | perl.perl5.porters | Postings from April 2000

PATCH 5.6.0: Eliminiate bizarre failure on bad -M argument

Thread Next
Mark-Jason Dominus
April 24, 2000 16:37
PATCH 5.6.0: Eliminiate bizarre failure on bad -M argument
Message ID:

Try this:

        perl  -M=carrot -e 0

It says:

        Can't locate in @INC ...

This is bizarre, and if there *were* a module, the behavior
would be even more bizarre.  The bizarre behavior occurs because
-Mthis=that is translated internally to use this split(/,/, 'that')

and when you omit `this' you get

        use split (/,/, 'that')

The enclosed patch to 5.6.0 tells Perl to abort in this case, giving
up the error message

        Module name required with -M option.

Mark-Jason Dominus 	  			       
I am boycotting Amazon. See for details.

--- perl.c      2000/04/24 23:16:47     1.1
+++ perl.c      2000/04/24 23:37:19
@@ -2135,6 +2135,8 @@
                    sv_catpv( sv, " ()");
            } else {
+                if (s == start)
+                    Perl_croak(aTHX_ "Module name required with -M option");
                sv_catpvn(sv, start, s-start);
                sv_catpv(sv, " split(/,/,q{");
                sv_catpv(sv, ++s);

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About