develooper Front page | perl.perl5.porters | Postings from January 2014

Re: [perl #121078] perlrun -M documentation minor error

Thread Previous | Thread Next
From:
Brad Gilbert
Date:
January 25, 2014 08:28
Subject:
Re: [perl #121078] perlrun -M documentation minor error
Message ID:
CAD2L-T0UjMSXpubZ0mtg8wPnUynme72KN12FgG2=A=YbrjUbhg@mail.gmail.com
On Fri, Jan 24, 2014 at 5:31 PM, perlbug@plan9.de
<perlbug-followup@perl.org> wrote:
>
> The perlrun documentation for -M/-m says:
>
>    Note that the "=" form removes the distinction between -m and -M.
>
> I don't think this is correct. The distinction between -m and -M is that
> one doesn't call import and the other does. While = can make -m call
> import, there doesn't seem to be a way to get the effect of -mX with
> -MX=..., i.e. -M always results in import being called.
>
> This is consistent with the documentation for "=": the split... expansion
> is never an explicit empty list as required by use to get the effect of
> "-m".
>
> That also means that, if I was just too dense to figure it out and there
> IS a way to get no important from -M, then the description of the "="
> expansion is wrong.
>

No it is correct. Adding the = makes -m behave like -M.
That is it removes the distinction -m has, making it the same as -M.

    $ perl -mstrict  -E'$_="a";$$_ ++'
    $ perl -mstrict= -E'$_="a";$$_ ++'
    Can't use string ("a") as a SCALAR ref while "strict refs" in use
at -e line 1.

    $ perl -Mstrict  -E'$_="a";$$_ ++'
    Can't use string ("a") as a SCALAR ref while "strict refs" in use
at -e line 1.
    $ perl -Mstrict= -E'$_="a";$$_ ++'
    Can't use string ("a") as a SCALAR ref while "strict refs" in use
at -e line 1.

Perhaps it should be worded better, but what is there is technically correct.

Thread Previous | 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