- or download this
$self->{m}->($self,@args); - or download this
package foo;
# dispatch table
my %m_implementation_for;
...
my $implementation = $m_implementation_for{$self};
$implementation->($self, @args);
}
- or download this
sub m {
my ($self, @args) = @_;
$m_implementation_for{$self}($self, @args);
}
- or download this
my %m_closure_for;
# after the implementations have been defined
...
my ($self, @args) = @_;
$m_closure_for{$self}(@args);
}