in reply to A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?
If I want to have can awareness I would have to overload can.
You can also predeclare the subs you want to AUTOLOAD.
That can be tricky business.
Not really. If your AUTOLOAD has some logic to determine whether it should generate a subroutine, you can factor that logic into a subroutine shared between AUTOLOAD and an overridden can.
You don't even have to go through gyrations in can to return a reference. Perl 5 autovivifies subroutines if you take references to them in the appropriate way. Of course, you can also factor out the code which installs the reference and share it between can and AUTOLOAD.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?
by lodin (Hermit) on Aug 29, 2009 at 23:58 UTC | |
by SilasTheMonk (Chaplain) on Aug 31, 2009 at 18:10 UTC | |
by lodin (Hermit) on Aug 31, 2009 at 21:49 UTC | |
by SilasTheMonk (Chaplain) on Sep 01, 2009 at 06:38 UTC | |
by lodin (Hermit) on Sep 01, 2009 at 11:00 UTC | |
|
In Section
Meditations