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

PATCH 5.6.0: Eliminiate bizarre failure on bad -M argument

Thread Next
From:
Mark-Jason Dominus
Date:
April 24, 2000 16:37
Subject:
PATCH 5.6.0: Eliminiate bizarre failure on bad -M argument
Message ID:
20000424233850.28315.qmail@plover.com

Try this:

        perl  -M=carrot -e 0

It says:

        Can't locate split.pm in @INC ...

This is bizarre, and if there *were* a split.pm 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 	  			                 mjd@plover.com
I am boycotting Amazon. See http://www.plover.com/~mjd/amazon.html 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About