Ovid wrote in perl.qa : > > You've run into a problem which surprises a few folks but definitely > causes problems. In a nutshell, use_ok internally traps the "use" > call with an eval. However, even if it fails (as in your case), the > bytecode might still be compiled and in memory and, as a result, some > tests might pass and others fail. As a result, *all* of my tests > generally start with something similar to the following (season to > test): > > my $CLASS; > BEGIN { > $CLASS = 'Some::Module'; > use_ok $CLASS or die; # "or die" saves the day
maybe BAIL_OUT could be better than die here, in at least a few cases. > } > can_ok $CLASS, 'new';