[Israel.pm] Implicit $self variable without Source Filters

Ran Eilam ran.eilam at gmail.com
Tue Nov 7 00:55:27 PST 2006


> > my $self = shift; at the beginning of methods. Now Spiffy uses a
> > source filter for this.
>
> Check out Module::Compile and Filter::Simple::Compile.

I can see how this would improve on source filters. E.g.
Module::Depends will no longer croak on "undeclared $self" for Spiffy
filtered packages, because it will look at the compiled versions.

But there are other problems with source filters. What else does the
.pmc approach solve?

> The more immediate downside is perhaps that since $self is not a lexical,
> it cannot be further closed upon. Unless it is copied, but that sort of
> misses the point of this magic. Still, this is pretty cool.

I don't understand the downside you are pointing at. What difference
does it make if $self is lexical or dynamic here?

-- 
 Ran Eilam ran.eilam at gmail.com



More information about the Perl mailing list