On Tue, 05 Nov 2002 21:03:04 GMT, [EMAIL PROTECTED] (Nicholas Clark)
wrote in news:20021105210303.GC280@;Bagpuss.unfortu.net: 

> 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.

Darn right it isn't, it's stupid. Stupid mistake (I'll excuse myself based 
on fatigue).

> _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.

Of course not. What was I thinking? Still, a comment in the code would have 
been a really nice idea -- to the effect of something like: "this sub gets 
used as a regular, non-method function".

> 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. 

Good grief, I have to express "I wonder why"? I am sure there are reasons 
and it's clear how full of hacks MM is. Sheesh tho. Anyway, I used it as a 
method call once I cleared up my little problem.

> 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.

Thanks, Nicholas, I am in fact subscribed to the List and I appreciate your 
kind reply.

   Soren A


-- 

                    --*perlspinr*--
**Helping to consume excess Internet bandwidth since 1996**


Reply via email to