in reply to Method Calls on multiple objects
On the error checking front, you may want to throw can into the mix, so methodname is only called if the object implements it.
sub MultiMethod { my $method = shift; my $args = shift; foreach my $object (@_) { $object->$method(@$args) if $object->can($method); } }
--k.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Method Calls on multiple objects
by diotalevi (Canon) on Mar 27, 2004 at 06:17 UTC | |
by chromatic (Archbishop) on Mar 27, 2004 at 20:04 UTC | |
by tilly (Archbishop) on Mar 28, 2004 at 07:15 UTC | |
by dragonchild (Archbishop) on Mar 28, 2004 at 00:25 UTC |