Is there any way to tell if my package is being tested automatically
under CPAN::Testers? Here's the situation:
I've never used that module but this should work:
if(exists $INC{'CPAN/Testers.pm'}) {
print "I am probably running under CPAN::Testers\n";
}
else {
print "I am probably *NOT* running under CPAN::Testers\n";
}
That should do what you want if I'm understanding your goal right
*unless* CPAN::Testers has been used but is not actually running the
test that includes the above logic.
Just my .02 about "detecting' it. I'd say the best thing to do is just
write good tests that pass regardless:
eval 'use Foo::Bar';
if($@) {
pritn "Skipping Foo::Bar test since its not installed apparently";
return 1;
}
else {
# run Foo::bar tests
}
then it doesn't matter whose using what where and when because you have
tests that are run if necessary and skipped (but not "failed") otherwise