package foo; # dispatch table my %m_implementation_for; # wrapper sub m { my ($self, @args) = @_; my $implementation = $m_implementation_for{$self}; $implementation->($self, @args); }