Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Adding functionality to an Objectby davorg (Chancellor) |
on Jul 13, 2006 at 09:18 UTC ( [id://560897]=note: print w/replies, xml ) | Need Help?? |
If you want to do it at runtime then you'll need to fiddle around with the "victim" object's symbol table. One example of doing this is in Symbol::Approx::Sub which inserts an AUTOLOAD function into its caller's symbol table. I wrote an article about how that works. You might find that useful. There are no doubt plenty of other modules on CPAN that do similar things. I'd guess that the Acme:: namespace would be a good place to start looking.
-- <http://dave.org.uk> "The first rule of Perl club is you do not talk about
Perl club."
In Section
Seekers of Perl Wisdom
|
|