Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

RFC - Perl::Critic policy to allow "my $self = shift;" to be valid for unpacking @_

by boftx (Chaplain)
on Sep 23, 2013 at 03:31 UTC ( #1055226=perlmeditation: print w/ replies, xml ) Need Help??

This is not only an RFC, but also a Request For Help.

In short, when I run this new policy against a simple test file I see the results I want, but it fails the regression test I've included from Perl::Critic. Beyond that, I would like suggestions for what config opitions might be desirable as well as help with documentation changes such as credits, etc.

The new policy project can be found on GitHub in the devel branch: https://github.com/boftx/Perl-Critic-Policy-Local-RequireArgUnpackOrShift/tree/devel

The following must be in the .perlcriticrc file:

exclude = Subroutines::RequireArgUnpacking include = Local::RequireArgUnpackOrShift

Those entries will allow the new policy to be picked up while at the same time disabling the policy it is intended to replace (assuming you are in the lib directory of the distro.)

The regression test can be run as you would expect from the top dir in the distro:

$ prove -l t

Again, assuming you are in the lib dir in the distro, you can run this command to test a given file and use the new policy:

$ perlcritic <path-to-file>/CriticTest.pm

Here is the source for CriticTest.pm:

[~/perl/test]# cat CriticTest.pm package CriticTest; use Moose; our $VERSION = '1.01'; has 'needs_build' => ( isa => 'Int', is => 'rw', lazy => 1, builder => '_build_needs_build', ); sub _build_needs_build { my $self = shift; my %args = @_; return $self; } 1; __END__

Please feel free to to leave comments (good, bad and ugly) here or on Git. I feel this could be a welcome additon on CPAN if I can work out the kinks with your kind help.

On time, cheap, compliant with final specs. Pick two.

Comment on RFC - Perl::Critic policy to allow "my $self = shift;" to be valid for unpacking @_
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1055226]
Approved by Corion
Front-paged by sparkyichi
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2014-09-24 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (243 votes), past polls