http://www.perlmonks.org?node_id=11145218


in reply to Testing of exception during import

FWIW, I would either use My::Test (); or require My::Test;. Both load the module without calling its import() method at all. Then call the import method explicitly:


use Test::Exception;
use My::Test ();

lives_ok { My::Test->import( 1, 2, 5 ) }, 'Three parameters';
throws_ok { My::Test->import( 1, 2 ) } m/Number of import parameters is wrong/, 'Two parameters';
...