Subject: | Can't set severity |
Using Test::Perl::Critic 1.01 with perl 5.8.6 on darwin 8.9.1 (MacOSX 10.4.9):
If you want your critic.t to play nice in the absence of Test::Perl::Critic, you have to:
eval { require Test::Perl::Critic; };
rather than:
eval { use Test::Perl::Critic; };
which will fail in the absence of the module being installed, or:
eval " use Test::Perl::Critic; ";
which is against the ProhibitStringyEval policy.
However, the only way that you can specify a severity setting is when using a use statement,
as in:
use Test::Perl::Critic(-severity => 5);
because passing in an argument when including a module via require will fail:
eval { require Test::Perl::Critic(-severity => 5); };
gives:
whitbread 1026 % perl -wc t/critic.t
syntax error at t/critic.t line 17, near "require Test::Perl::Critic"
BEGIN not safe after errors--compilation aborted at t/critic.t line 19.
Thus, there is a catch 22 - you want to 'require' it to play nice, but you can't pass in the
severity in the require, so you have to 'use' it, but to do so you have to violate a policy!
Adding a method to allow setting of the severity would solve the conundrum.