Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Adding a method to an existing object

by draegtun (Scribe)
on Feb 17, 2012 at 16:56 UTC ( [id://954566]=note: print w/replies, xml ) Need Help??


in reply to Adding a method to an existing object

The following two modules on CPAN allow you to add methods to an object:

* MooseX::SingletonMethod (for Moose objects)
* Object::Method (for normal Perl objects)

Alternatively in Moose you can apply roles directly to an object:

    YourRole->meta->apply( $your_object ); # $your_object now has the methods from YourRole

I did a few blog posts on how roles work and howto implement singleton-methods (in Moose). They're listed in the MooseX::SingletonMethod CPAN page. Also this link should bring them up.

/I3az/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found