sub foo_a { my ($self, $arg) = @_; # method A for processing $arg } sub foo_b { my ($self, $arg) = @_; # method B for processing $arg } sub foo { my ($self, $arg) = @_; $self->{'foo_code'}->($self, $arg); # XXX } sub foo_set { my ($self, $code) = @_; $self->{'foo_code'} = $code; }