thedi has asked for the wisdom of the Perl Monks concerning the following question:
I have an object of an unknown class and I want to invoke a method of which I will know the name only at execution time.
I can test if the object contains this method with
if ( $obj->can( $method ) ) { # now I want to invoke $method on $obj
How?
Thanks for any hints
Regards Thedi gerber@id.ethz.ch
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Invoke a method on an object
by Corion (Patriarch) on Jan 13, 2009 at 10:19 UTC | |
by thedi (Acolyte) on Jan 13, 2009 at 11:26 UTC | |
by pobocks (Chaplain) on Jan 13, 2009 at 15:32 UTC | |
by Corion (Patriarch) on Jan 13, 2009 at 15:36 UTC | |
by pobocks (Chaplain) on Jan 13, 2009 at 15:38 UTC | |
by merlyn (Sage) on Jan 13, 2009 at 15:59 UTC | |
| |
|
Re: Invoke a method on an object
by moritz (Cardinal) on Jan 13, 2009 at 10:18 UTC | |
|
Re: Invoke a method on an object
by Bloodnok (Vicar) on Jan 13, 2009 at 12:10 UTC |