Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 15287
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: thaljef [...] cpan.org
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.13



Subject: Package and VERSION policies should not apply to scripts
Some of my distributions include command-line scripts that end up in blib/script/. Test::Perl::Critic finds these and issues the following false positives: # Unpackaged code at line 6, column 1. Violates encapsulation. # No 'VERSION' variable found at line 0, column 0. See page 404 of PBP. Perhaps Test::Perl::Critic should alter its behavior when it discovers that it is looking in blib/script OR perhaps it can leverage the Critic.pm code that removes the magic eval and that can be the trigger to disable the Module-only policies. -- Chris
Scripts can be excluded from the ProhibitUnpackagedCode policy by setting 'exempt_scripts' in the perlcriticrc. I will add a similar feature to the RequireVersionVar policy, although I can't honestly think of a good reason why scripts shouldn't have a $VERSION.
From: cdolan [...] cpan.org
[THALJEF - Fri Oct 28 19:02:02 2005]: Show quoted text
> Scripts can be excluded from the ProhibitUnpackagedCode policy by > setting 'exempt_scripts' in the perlcriticrc. I will add a similar > feature to the RequireVersionVar policy, although I can't honestly > think of a good reason why scripts shouldn't have a $VERSION.
Thanks Jeff, I discovered the "exempt_scripts" option only after posting this bug. Perhaps it should default to true since it's rather uncommon for people to put "package main" in all of their scripts. As for VERSION, I sometimes have more than one version of a .pm installed in different versions of Perl, but only one version of the script installed in, say, /usr/bin or /sw/bin. Consequently, I write my scripts to be as unintrusive as possible into the .pm API and responds to -V by printing the $VERSION of the .pm. The core of the problem is that @INC is versioned, but $PATH is not. -- Chris