In MyClass.pm: { package MyClass; use mymodule; # call some function from mymodule } #### In myapp.pl: use mymodule; # call some function from mymodule #### #!/usr/bin/perl -w use strict; use warnings; { package MyClass; use Class::Contract; use test_func; contract { attr 'test'; ctor 'new'; impl { ${self->test} = test_me('within class'); }; }; }; package main; use test_func; test_me('in main'); #### sub test_me { my $txt = shift; print "Exec of test_me with: $txt\n"; return $txt; } 1; #### Undefined subroutine &main::test_me called at test_loading.pl line 25