Keep It Simple, Stupid | |
PerlMonks |
Re: Adding functionality to an Objectby davorg (Chancellor) |
on Jul 13, 2006 at 08:58 UTC ( [id://560892]=note: print w/replies, xml ) | Need Help?? |
Yes. You can do that. The best way is probably to subclass the object and add your new methods to the subclass. But it's perfectly possible to add methods to an existing object. A method is just a subroutine that exists in a particular symbol table. You just have to switch to the correct package and define a new subroutine.
-- <http://dave.org.uk> "The first rule of Perl club is you do not talk about
Perl club."
In Section
Seekers of Perl Wisdom
|
|