in reply to Re^2: Subroutines with differing behaviour created from AUTOLOAD
in thread Subroutines with differing behaviour created from AUTOLOAD
No, it means only that you should declare my $self in the subs you create, as in my example - without such a declaration, the $self in the anonymous subs refers to the closest enclosing declaration (the my $self of the AUTOLOAD routine), and that is what creates the unwanted closure.
You might prefer to further reduce the potential for confusion by using a different variable name for the two: perhaps by renaming the outer $self to $object or somesuch.
Hugo
|
|---|