Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the Module-Starter-PBP CPAN distribution.

Report information
The Basics
Id: 18293
Status: open
Priority: 0/
Queue: Module-Starter-PBP

Owner: Nobody in particular
Requestors: steve.kirkup [...]

Bug Information
Severity: Normal
Broken in: v0.0.3
Fixed in: (no value)

Subject: perlcritic.t Template is incorrect
Download (untitled) / with headers
text/plain 960b
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.
Download (untitled) / with headers
text/plain 733b
Yeah, I would agree that this isn't quite right. Test::Perl::Critic 0.05 (which will be released this weekend) also allows you to configure Perl::Critic via the C<import> interface. So this is the template that I plan to put in the T:P:C documentation: #!perl use strict; use warnings; use English qw(-no_match_vars); use Test::More; eval { require Test::Perl::Critic; my @config = (); #Arguments for Perl::Critic->new() go here! Test::Perl::Critic->import( @config ); }; if( $EVAL_ERROR ) { plan( skip_all => 'Test::Perl::Critic required for PBP tests' ); } all_critic_ok(); I know its a bit verbose, but it is mostly to be compliant with Perl::Critic and PBP. Cheers. -Jeff

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to