Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Adding functionality to an Object

by davorg (Chancellor)
on Jul 13, 2006 at 09:18 UTC ( #560897=note: print w/replies, xml ) Need Help??

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.


"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re^3: Adding functionality to an Object

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560897]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2021-04-13 14:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found