On Nov 05, Soren A wrote:
> In ExtUtils::MM_Unix, in the sub pm_to_blib(), there is:
> 
> -------------------------------8<----------------------------------  
>     sub pm_to_blib {
>         my $self = shift;
>         my($autodir) = File::Spec->catdir('$(INST_LIB)','auto');
>         my $r = q{
>     pm_to_blib: $(TO_INST_PM)
>     };
>         my %pm_to_blib = %{$self->{PM}};
>         my @a;
>         my $l = 0;
>         while (my ($pm, $blib) = each %pm_to_blib) {
>       my $la = length $pm;
>       my $lb = length $blib;
>       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);
>         return $r.q{  }.$self->{NOECHO}.q{$(TOUCH) $@};
>     }
>   
> -------------------------------8<----------------------------------
> 
> 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.

    It's not a method invocation.  "foo($bar, $baz)" is a function
call.  It would have to be written as "$self->_pm_to_blib_flush(...)"
to be interpreted as method invocation (which would result in the
implicit pushing of the calling object onto the parameter list, and
looking up &_pm_to_blib_flush in the @ISA hierarchy).

        - Kurt

Reply via email to