[Chicago-talk] ->can and AUTOLOAD

Steven Lembark lembark at wrkhors.com
Thu Dec 4 10:51:33 CST 2003



-- Jay Strauss <me at heyjay.com>

> If I use AUTOLOAD in a class, and then do ->can on that class, it comes
> back not found.  I thought AUTOLOAD would catch all and I could do ->can
> on any method and AUTOLOAD would pick it up

$foo->can( 'AUTOLOAD' ) should work if there is an AUTOLOAD
defined. Can is checking the symbol table, not executing the
AUTOLOAD sub itself in order to instantiate a subroutine for
you. If you need to use $foo->can with things that are created
with autoloader then you will have to stub the names to a sub
that trampolines them into core rather than an autoload.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list