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

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

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



Subject: Policy/ClassHierarchies/ProhibitExplicitISA.pm - add recommendation: use parent
"use base" and "use fields" are very old modules. 2007 the slim "use parent" was created that modificates @ISA only. That is all we need for inheritance. "use base" is much more. Please add "use parent" as alternative recommendation. --Steffen
Subject: Re: [rt.cpan.org #70763] Policy/ClassHierarchies/ProhibitExplicitISA.pm - add recommendation: use parent
Date: Tue, 06 Sep 2011 10:14:01 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
That's not really true. Noone reads the Pod of the rules. Only the messages are important. What I mean is: 0022: Readonly::Scalar my $DESC => q{@ISA used instead of "use base"}; ## no critic (RequireInterpolation) In another rule "lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMagicNumbers.p m" it is better: 0026: Readonly::Scalar my $USE_READONLY_OR_CONSTANT => 0027: ' Use the Readonly or Const::Fast module or the "constant" pragma instead';
Subject: Re: [rt.cpan.org #70763] Policy/ClassHierarchies/ProhibitExplicitISA.pm - add recommendation: use parent
Date: Tue, 06 Sep 2011 14:58:14 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 9/6/11 2:19 PM, Steffen Winkler via RT wrote: Show quoted text
> That's not really true. > Noone reads the Pod of the rules. Only the messages are important.
/I/ certainly do when I run into a violation. perlcritic --doc Whatever
RT-Send-CC: perl [...] galumph.com
Le 2011-09-06 16:12:14, STEFFENW a écrit : Show quoted text
> "use base" and "use fields" are very old modules. > 2007 the slim "use parent" was created > that modificates @ISA only. > That is all we need for inheritance. > "use base" is much more. > Please add "use parent" as alternative recommendation.
I agree. And I submitted a patch against Perl::Critic itself to drop most of its usage of "base": https://rt.cpan.org/Ticket/Display.html?id=75300 Note that parent.pm has been created by the Perl 5.10 pumpking, and is in core since 5.10. This is more recent (2007) that the PBP (2005), but shouldn't the policies adapt to the modern times? -- Olivier Mengué - http://perlresume.org/DOLMEN
A bit more background is in this perl core bug report: https://rt.perl.org/rt3//Public/Bug/Display.html?id=112916 It sounds like (a) perlcritic should always recommend 'use parent' and not recommend 'use base', and (b) there could even be a new policy warning about 'use base' and suggesting 'use parent' instead.