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

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

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



Subject: Recognize 'Modern::Perl'
The module Modern::Perl packages up several 'best practice' options into one line. You can just say use Modern::Perl; and it turns on warnings, strict, 5.010, and C3 method resolution. The policies RequireUseStrict and RequireUseWarnings should recognize that Modern::Perl turns on these options.
Here's a patch: Index: Perl-Critic/t/TestingAndDebugging/RequireUseStrict.run =================================================================== --- Perl-Critic/t/TestingAndDebugging/RequireUseStrict.run (revision 3148) +++ Perl-Critic/t/TestingAndDebugging/RequireUseStrict.run (working copy) @@ -154,6 +154,15 @@ #----------------------------------------------------------------------------- +## name Modern::Perl support +## failures 0 +## cut + +use Modern::Perl; +$foo = $bar; + +#----------------------------------------------------------------------------- + ## name equivalent_modules ## failures 0 ## parms { equivalent_modules => 'Foo' } Index: Perl-Critic/t/TestingAndDebugging/RequireUseWarnings.run =================================================================== --- Perl-Critic/t/TestingAndDebugging/RequireUseWarnings.run (revision 3148) +++ Perl-Critic/t/TestingAndDebugging/RequireUseWarnings.run (working copy) @@ -188,6 +188,15 @@ #----------------------------------------------------------------------------- +## name Modern::Perl support +## failures 0 +## cut + +use Modern::Perl; +$foo = $bar; + +#----------------------------------------------------------------------------- + ## name equivalent_modules ## failures 0 ## parms { equivalent_modules => 'Foo' } Index: Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm =================================================================== --- Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm (revision 3148) +++ Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseStrict.pm (working copy) @@ -33,7 +33,7 @@ default_string => $EMPTY, behavior => 'string list', list_always_present_values => - [ qw< strict Moose Moose::Role Moose::Util::TypeConstraints > ], + [ qw< strict Moose Moose::Role Moose::Util::TypeConstraints Modern::Perl > ], }, ); } @@ -134,10 +134,10 @@ code in the entire package will be affected. There are special exemptions for L<Moose|Moose>, -L<Moose::Role|Moose::Role>, and -L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints> because -they enforces strictness; e.g. C<'use Moose'> is treated as -equivalent to C<'use strict'>. +L<Moose::Role|Moose::Role>, +L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints>, +and L<Modern::Perl|Modern::Perl> because they enforce strictness; +e.g. C<'use Moose'> is treated as equivalent to C<'use strict'>. The maximum number of violations per document for this policy defaults to 1. Index: Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm =================================================================== --- Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm (revision 3148) +++ Perl-Critic/lib/Perl/Critic/Policy/TestingAndDebugging/RequireUseWarnings.pm (working copy) @@ -38,7 +38,7 @@ default_string => $EMPTY, behavior => 'string list', list_always_present_values => - [ qw< warnings Moose Moose::Role Moose::Util::TypeConstraints > ], + [ qw< warnings Moose Moose::Role Moose::Util::TypeConstraints Modern::Perl > ], }, ); } @@ -142,11 +142,10 @@ statements. Thus, all the code in the entire package will be affected. -There are special exemptions for L<Moose|Moose>, -L<Moose::Role|Moose::Role>, and -L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints> because -they enforces warnings; e.g. C<'use Moose'> is treated as -equivalent to C<'use warnings'>. +There are special exemptions for L<Moose|Moose>, L<Moose::Role|Moose::Role>, +L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints>, and +L<Modern::Perl|Modern::Perl> because they enforce warnings; e.g. +C<'use Moose'> is treated as equivalent to C<'use warnings'>. This policy will not complain if the file explicitly states that it is compatible with a version of perl prior to 5.6 via an include
The patch still applies cleanly against 1.098. Would you consider it for inclusion?
Subject: Re: [rt.cpan.org #43457] Recognize 'Modern::Perl'
Date: Mon, 16 Mar 2009 19:52:41 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
EDAVIS via RT wrote: Show quoted text
> The patch still applies cleanly against 1.098. Would you consider it > for inclusion?
I think we're done with adding modules to the defaults. Use the equivalent_modules option for both of these policies. In regards to Modern::Perl specifically, I don't think chromatic has addressed what happens when 5.12 comes around. Does he suddenly break all of your code?
On Mon Mar 16 20:52:55 2009, clonezone wrote: Show quoted text
> EDAVIS via RT wrote:
> > The patch still applies cleanly against 1.098. Would you consider
> it
> > for inclusion?
> > I think we're done with adding modules to the defaults. Use the > equivalent_modules option for both of these policies.
This is a rather arbitrary decision; so a relatively obscure module like Moose::Util::TypeConstraints that turns on strict almost as a side effect is accepted, but Modern::Perl (whose very raison d'etre is to turn on strict and warnings) is not. I appreciate that having a list of modules in the perlcritic code is not the most scalable way of doing it, but if you do have that, there is no reason to exclude some modules and include others just on the basis they were there first. Show quoted text
>In regards to Modern::Perl specifically, I don't think chromatic has >addressed what happens when 5.12 comes around. Does he suddenly break >all of your code?
I don't know about that, but I don't think perlcritic should pick winners and losers in this way. Perhaps a more reasonable way to resolve this would be for Modern::Perl (and other modules in the same spirit) to have some kind of marker which is noticed by perlcritic. Then there would be no need for the default configuration to have a list of them.
Subject: Re: [rt.cpan.org #43457] Recognize 'Modern::Perl'
Date: Wed, 25 Mar 2009 15:06:55 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Jeffrey Thalhammer <jeff [...] imaginative-software.com>
Show quoted text
>>> The patch still applies cleanly against 1.098. Would you consider >>> it >>> for inclusion?
>> >> I think we're done with adding modules to the defaults. Use the >> equivalent_modules option for both of these policies.
> > This is a rather arbitrary decision; so a relatively obscure module > like > Moose::Util::TypeConstraints that turns on strict almost as a side > effect is accepted, but Modern::Perl (whose very raison d'etre is to > turn on strict and warnings) is not. > > I appreciate that having a list of modules in the perlcritic code is > not > the most scalable way of doing it, but if you do have that, there is > no > reason to exclude some modules and include others just on the basis > they > were there first.
I tend to agree with Ed on this. But since the list is user- configurable, please understand that this isn't a high priority. I really appreciate the patch, and we'll apply it as soon as this issue comes up in the queue. Thanks. -Jeff
Subject: Re: [rt.cpan.org #43457] Recognize 'Modern::Perl'
Date: Sun, 17 May 2009 13:54:56 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
EDAVIS via RT wrote: Show quoted text
> On Mon Mar 16 20:52:55 2009, clonezone wrote:
>> EDAVIS via RT wrote:
>>> The patch still applies cleanly against 1.098. Would you >>> consider it for inclusion?
>> >> I think we're done with adding modules to the defaults. Use the >> equivalent_modules option for both of these policies.
> > This is a rather arbitrary decision; so a relatively obscure module > like Moose::Util::TypeConstraints that turns on strict almost as a > side effect is accepted, but Modern::Perl (whose very raison d'etre > is to turn on strict and warnings) is not.
If you use Moose, Moose::Util::TypeConstraints shouldn't be obscure. In regards to Modern::Perl, I wrote a blog post: http://elliotlovesperl.com/2009/05/17/the-problem-with-modernperl/.
Show quoted text
> In regards to Modern::Perl, I wrote a blog post: > http://elliotlovesperl.com/2009/05/17/the-problem-with-modernperl/.
I'm not sure what is more lame, your rational, or your twitter-like blog without comments... Your argument isn't addressing chromatic's module, it is addressing the word "Modern", and the nature of referencing the future in the present. Modern::Perl, like my nextgen.pm, is supposed to move with perl. I should remind you this is how *most* software works, and ironically even though perl has 'features', it works like this to: between perl 5.10.0, and 5.10.1, we know that Perl 5.10's misimplimentation of smart match is what is responsible for breaking code -- not Chromatic's module. Even without 'features' just the binary makes all of your code fundamentally incompatible -- and it is only a minor point release. By any means, not upgrading Perl Critic because you want to make a political statement about Modern::Perl is lame. Even more lame than your almost wholly deceptive statement about Moose::Util::TypeConstraints (which is almost totally deprecated with the much improved MooseX::Types). Found via open bug on Modern::Perl: https://rt.cpan.org/Ticket/Display.html?id=47568 -- Evan Carroll System Lord of the Internets http://www.evancarroll.com