pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Ye monks who doth perl encode!
Can I add functions to a package on the fly? For example, could something like this be made to work?
package blort; sub add_method { my $name = shift; ## Do some Magic } ... use blort; blort::add_method('foo'); blort::foo();
I want to know how things like Class::MethodMaker and similer things work. Class::MethodMaker creates the subs at compile time. Is it possible to add subs during run time?
Thanks!
-Pileofrogs
Update: You all rock!! ++ all round! Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sub on the fly?
by liverpole (Monsignor) on Aug 16, 2006 at 23:07 UTC | |
|
Re: Sub on the fly?
by chromatic (Archbishop) on Aug 16, 2006 at 23:08 UTC | |
by stvn (Monsignor) on Aug 17, 2006 at 11:52 UTC | |
|
Re: Sub on the fly?
by ysth (Canon) on Aug 16, 2006 at 23:08 UTC | |
by stvn (Monsignor) on Aug 17, 2006 at 12:14 UTC | |
by phaylon (Curate) on Aug 17, 2006 at 15:41 UTC | |
|
Re: Sub on the fly?
by stvn (Monsignor) on Aug 17, 2006 at 12:11 UTC | |
|
Re: Sub on the fly?
by kwaping (Priest) on Aug 16, 2006 at 23:27 UTC | |
by stvn (Monsignor) on Aug 17, 2006 at 11:59 UTC |