On Feb 18, 2009, at 2:32 PM, Roger Hall wrote:

Jonas,

Honestly I just left the default perlcritic test script in my package as generated by Module::Starter. This was the first time I had done so, and I really had no idea about Perl::Critic until last night when my module failed "smoke" testing after upload to CPAN. From the test script I am guessing
that I cannot alter the verbosity setting (running on someone else's
automated server).


#!perl

if (!require Test::Perl::Critic) {
    Test::More::plan(
skip_all => "Test::Perl::Critic required for testing PBP compliance"
    );
}

Test::Perl::Critic::all_critic_ok();
--snip--

You *can* alter the verbosity.

Two relevant points from http://search.cpan.org/perldoc? Test::Perl::Critic :
1) You can configure like this:
    use Test::Perl::Critic ( -profile => 't/perlcriticrc' );
or this:
use Test::Perl::Critic ( -severity => 2, -exclude => ['RequireRcsKeywords'] );
or this:
    use Test::Perl::Critic ( -verbose => 6 );
Therefore, something like this should work (untested):
    if (!require Test::Perl::Critic) {
plan skip_all => "Test::Perl::Critic required for testing PBP compliance";
    }
    else {
        Test::Perl::Critic->import(
            -verbose  => 8,
            -severity => 3,
            -exclude  => ['ProhibitAccessOfPrivateData']
        );
    }

2) The section "Recommended usage for CPAN distributions" details how to set your module to run the perlcritic tests only in TEST_AUTHOR mode.

--
Hope this helps,
Bruce Gray

Reply via email to