##
package MultiMethod;
use strict;
use warnings;
use vars '$AUTOLOAD';
sub new {
my $class = shift;
my $self = \@_;
return bless $self , $class;
}
sub DESTROY { return; }
sub AUTOLOAD {
my $self = shift;
if ( $AUTOLOAD =~ /::([^:]+)$/ ) {
$_->$1(@_) for @$self;
}
}
42;
##
##
MultiMethod( 'methodname', [], $file, $file2 );
sub MultiMethod {
my $method = shift;
my $args = shift;
$_->$method(@$args) for @_;
}