[Mpls-pm] Dumb Question...Module Method - Dual Name
Ian Malpass
ian at indecorous.com
Tue Nov 1 13:03:11 PST 2005
On Tue, 25 Oct 2005, Dave Rolsky wrote:
> AUTOLOAD also breaks calls to ->can(), unless you overload that as well.
Or do forward declaration of the subs you're going to want to AUTOLOAD
(according to the UNIVERSAL and perlsub documentation, which I have just
read).
Thus,
package Example;
sub Foo;
then
$eg->can( 'Foo' );
will return true (well, a reference to &Foo, which would then fall through
to the AUTOLOADer).
Of course, that means you have to declare any subs you want to work with
can(), but I don't like having open-ended AUTOLOADers anyway, so I usually
know the list of methods it's going to work on.
> Frankly, I think AUTOLOAD is bad, bad, bad, and I question it's use at
> all.
I *did* say it was a snare for the unwary ;)
But yes, Class::MethodMaker is also groovy (if a little over-engineered,
perhaps) and your closure code is likewise groovy.
Ian
-
---------------------------------------------------------------------------
The soul would have no rainbows if the eyes held no tears.
Ian Malpass
<ian at indecorous.com>
More information about the Mpls-pm
mailing list