http://qs321.pair.com?node_id=560897


in reply to Re^2: Adding functionality to an Object
in thread Adding functionality to an Object

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."
-- Chip Salzenberg