Subject: | perlcritic.t Template is incorrect |
MIME-Version: | 1.0 |
X-Mailer: | MIME-tools 5.418 (Entity 5.418) |
Content-Type: | text/plain; charset="utf8" |
Content-Disposition: | inline |
Content-Transfer-Encoding: | binary |
X-RT-Original-Encoding: | utf-8 |
Content-Length: | 960 |
The default perlcritic.t template has two problems,
if (!require Test::Perl::Critic) {
Test::More::plan( skip_all => "Test::Perl::Critic required for testing
PBP compliance" );
}
The first problem is that the require will display a message that it
cannot find the module in the @INC.
The second problem is that after the failure, Test::More has not 'used'
so it cannot call plan, generating another error.
My suggested for the template is,
eval 'use Test::Perl::Critic';
if ($@) {
eval 'Test::More';
plan( skip_all => "Test::Perl::Critic required for testing PBP
compliance" );
}
The first eval will not display a message if it is not installed. The
second eval is to load Test::More only if there is a problem with
Test::Perl::Critic. I did not want to load with 'use' if there is not a
problem.
I am also assuming that Test::More is installed on the local system
because that is what you use to test Module::Starter::PBP when it is
installed.