--in MyPackage.pm #!/usr/bin/perl -w package MyPackage; use strict; sub new { my ( $class ) = @_; my $self = {}; bless $self, $class; return $self; } sub execute { my $self = shift; my $coderef = shift; my $s = $self; return &$coderef( ); } sub helper { my $self = shift; print "in helper\n"; } 1; --in MyTest.pl #!/usr/bin/perl -w use strict; use MyPackage; my $test = MyPackage->new(); $test->execute( sub { print "in the local coderef\n"; $test->helper(); } );