##
# in the main
my $pkg = shift;
no strict 'refs';
eval "require $pkg";
if($@) {
croak "Failed to load $pkg: $@\n";
}
print foobar();
####
# in Foo.pm
package Foo;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(foobar);
sub foobar {
return "Foo!";
}
1;