On Tue, Nov 05, 2002 at 06:53:38PM -0000, Soren A wrote:
> Hello,
> 
> In ExtUtils::MM_Unix, in the sub pm_to_blib(), there is:

>       if ($l + $la + $lb + @a / 2 > 200) { # limit line length
>           _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);
>             }
>             push @a, $pm, $blib;
>       $l += $la + $lb;
>         }
>         _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);

> Why is the list of parameters being passed to _pm_to_blib_flush()
> with "$self" as the first argument? That makes "$self" appear TWICE
> to the latter sub. Once, implicitly, as in any method invocation;
> and a second time because of the explicit argument.

I don't think that your analysis is correct.
_pm_to_blib_flush is being called as a regular subroutine. In perl5 there
is no implicit invocant in $_[0] if a sub is called as a regular subroutine,
even if it functions as a method in a class.

I believe that the code above is written that way to fake a method call of the
form

    $self->_pm_to_blib_flush($autodir, \$r, \@a, \$l);

which does end up with the invocant object as $_[0] inside the subroutine.

> Is this not erronious code? It caused an error caught under the
> "strict 'refs'" conditions when I ran it; because a later arg
> that is supposed to be a string scalar is used instead as a
> scalar ref. I mean, the args all out of joint.

I'm not sure if it is erroneous code; I don't know if MM_Unix (or any part
of MakeMaker) is expected to work under use strict; It might be that a
soft reference was intended.

The person who probably knows best is Schwern, and he's currently out of
contact. This is a big reason this list is rather quiet currently.

I hope that either I removed the spam protection in your e-mail address
correctly, or that you are subscribed to the list, else you may never
see this reply.

Nicholas Clark
-- 
INTERCAL better than perl?      http://www.perl.org/advocacy/spoofathon/

Reply via email to