sub install_method { my $package = shift; foreach my $method (@_) { no strict 'refs'; *{$package . '::' . $method} = sub { # Do whatever you want here. You can reference $method and any other # lexical variables, just like any closure. }; } } __PACKAGE__->install_method qw( start middle end );