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


in reply to Testing of exception during import

G'day Dirk80,

You may already be aware of this, but in case not, I thought I'd point out that your import routine will not be called if your module is loaded like this:

use My::Test ();

See the use function, in particular:

"... there is a distinction between omitting LIST (import called with no arguments) and an explicit empty LIST () (import not called)."

It's possible that you have an "XY Problem" here. If you provided some information about the specific problem you're trying to solve, we may be able to offer other (better) solutions.

— Ken