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

People
Owner: Nobody in particular
Requestors: gstainsb [...] bigpond.net.au
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: False Positive Package Declaration
Date: Sun, 11 Sep 2011 17:51:46 +1000
To: <bug-perl-critic [...] rt.cpan.org>
From: "Gerard Stainsby" <gstainsb [...] bigpond.net.au>
Download (untitled) / with headers
text/plain 736b
Environment: MS Windows Vista X64 ActiveState Perl v5.14.1 build 1401 (X64) perlcritic version 1.116 This is an issue only for OSs with case-insensitive file-systems... if perlcritic is called specifying a module name using the wrong case, it complains 'Package declaration must match filename at...', even if the Package declaration in the module is actually correct. Here's an example using a standard module: cd /bin/perl/lib perlcritic file/glob.pm ... generates the warning. if correctly invoked: perlcritic File/Glob.pm ... no warning is generated. I suggest that perlcritic should query the filesystem, rather than rely on the command line arguments to decide whether the package statement is correct. Cheers, Gerard
Download (untitled) / with headers
text/plain 1.6k
I can't claim to speak for other developers, but my take on this is that it is a true positive. Perl requires that the file name be the same as the module name. You told perlcritic to analyze "file/glob.pm", and it found no 'package file::glob'. The fact that the file system merrily hands you the contents of "File/Glob.pm" when you ask for "file/glob.pm" does not change this, because it's still not portable. Perl itself behaves exactly the same way, as you can see from $ perl -Mfile::glob=bsd_glob -le 'for (bsd_glob( "*" ) ) {print}' Lest you think I'm unsympathetic because I'm a Unix geek, I type this on a machine running Mac OS 10.5, which displays exactly the same behavior. And there are times when I very much wish it were different. Try $ perldoc CPAN and $ perldoc cpan You get the documentation for the 'cpan' command for both, and so do I. A Unix person gets the documentation for CPAN.pm from the first example. I believe I have seen discussion among the Perl developers on this, but there has been no resolution. And, frankly, that's another reason the behavior of perlcritic will not be changed (by me, anyway) even if we grant that it's wrong: if the core Perl maintainers are not smart enough to sort this out, I'm certainly not. One of the issues, I believe, is that there is really no good way to tell whether you are dealing with a case-sensitive file system. Operating system does not tell you this. You or I could mount a disk having the Unix file system, and we would get 'file not found' in the example you submit. A Unix user could mount an NTFS, DOS, or HFS (the Mac OS native file system) disk, and get the same behavior we got.
Download (untitled) / with headers
text/plain 559b
Le 2011-11-17 18:49:36, WYANT a écrit : Show quoted text
> I can't claim to speak for other developers, but my take on this is that > it is a true positive. Perl requires that the file name be the same as > the module name. You told perlcritic to analyze "file/glob.pm", and it > found no 'package file::glob'. The fact that the file system merrily > hands you the contents of "File/Glob.pm" when you ask for "file/glob.pm" > does not change this, because it's still not portable.
I agree, so I propose to reject the bug. -- Olivier Mengué - http://perlresume.org/DOLMEN


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.