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: 46598
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: ericp [...] activestate.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.098
Fixed in: (no value)



Subject: RequireFilenameMatchesPackage doesn't fire with shebang line
perl -v: ActivePerl 5.10.0.1003 (perl v5.10.0) Linux Fedora release 9 (Sulphur) Using -mcriticism as a command-line wrapper has problems when there's a shebang line. Input file X.pm: #=================== #!/usr/bin/env perl package Y; use strict; use warnings; 1; #=================== $ perl -mcriticism=harsh -cw X.pm X.pm syntax OK $ perlcritic --harsh X.pm Package declaraion must match filename at line 3, column 1.... $ If I comment out the shebang line, I get the same warning using -mcriticism. I prefer to use criticism, because then I see problems Perl-Critic doesn't catch. fails to give the "Package declaration
Subject: Re: [rt.cpan.org #46598] RequireFilenameMatchesPackage doesn't fire with shebang line
Date: Mon, 01 Jun 2009 21:59:51 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
ericp@activestate.com via RT wrote: Show quoted text
> Using -mcriticism as a command-line wrapper has problems when there's > a shebang line.
If you've got a shebang line, the file is treated as a program. Consider me clueless, but why would you want to treat a module as a program?
On Mon Jun 01 23:00:28 2009, clonezone wrote: Show quoted text
> ericp@activestate.com via RT wrote:
> > Using -mcriticism as a command-line wrapper has problems when
> there's
> > a shebang line.
> > If you've got a shebang line, the file is treated as a program. > Consider me clueless, but why would you want to treat a module as a > program?
For testing purposes only: #!/usr/bin/env perl package Foo; ... if (!caller) { # test Foo... } 1; ######################## So let's see if anyone does it. In my 5.10 install I find 6 .pm files (out of 1179) that start with a hashbang, and none of those 6 do unit-testing that way. Meanwhile, the only modules I find with such testing are in lib/Pod/Simple. Looks like testing is done with .t files only. I stand corrected.