sub makeMethod { my $this = shift; $this->{_coderef} = eval $this->{_codestring} } sub callMethod { my $this = shift; $this->{_coderef}->(@_) }
If you want to do something like this:
then I think you'll have to use AUTOLOAD or some module that provides that functionality.$this->makeMethod( "somenewname", "some code" ); $this->somenewname();
In reply to Re: on the fly methods
by Thelonius
in thread on the fly methods
by Ojosh!ro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |