Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Adding functionality to an Object

by davorg (Chancellor)
on Jul 13, 2006 at 09:18 UTC ( [id://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.

--
<http://dave.org.uk>

"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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found