package Bar; use Foo::XXX; sub create_foo { return Foo::XXX->new(@_); } #### use Bar; my $foo = Bar->create_foo;