eval{ require Test::Foo::Bar; }; your_error_handled_here();