eval "use Foo::Bar"; eval <<"END" unless $@; sub my_method { # Code } END