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


in reply to Re^5: Does anybody write tests first?
in thread Does anybody write tests first?

Sorry, but you'll have to explain to me how testing that perl can load a module detected a bug...

Module loading in Perl 5 is not transactional. If there's a compilation error halfway through the code and the rest of the module fails to compile, all of the symbols defined in the first half and all of the side effects executed as a result of compiling the first half are still in effect.

The best way I've found to detect that is to use the return value of use_ok:

use_ok( 'Some::Module' ) or exit;

If the module fails to load completely, the test file will stop execution right there.