|laziness, impatience, and hubris|
In an earlier thread, it was suggested that I go ahead and write a policy that does what I want. Good advice, and I have undertaken the task, but I seem to have run into a fundamental flaw that has to do with how policies can be disabled in the config file.
My goal is to sub-class Subroutines::RequireArgUnpack and modify sub violates so that it will recognize a string similar to my $self = shift; as a valid way to unpack @_. I have a (very) crude first approximation working as I desire. But...
Both my sub-class and the original module are loaded, and executed by perlcritic. The obvious solution is to exclude Subroutines::RequireArgUnpack in .perlcriticrc, but this also prevents my new sub-class from executing, too. I also tried forcing mine to be loaded anyway with an include statement, but that does not work.
The only approach that I have found that will do what I want to do is to take a full cut and paste of Subroutines::RequireArgUnpack to my new policy without trying to subclass it, make my changes, and then exclude the original.
This is not desirable. In a perfect world I could make a sub-class, override a single method, and then have my sub-classed version pulled in even when the parent class has been excluded. There is no way I am going to put a module on CPAN that is a cut-and-paste with only (relatively) minor changes, and I have seen a few discussions elsewhere complaining about issue I raised to make this a worthy contribution otherwise. Obviously I can do what is needed for our private install at work, but it is always better to give back to CPAN when possible.
Does anyone have any thoughts on how to get past how Perl::Critic excludes policies? I suspect the behavior I am seeing is related to the use of Module::Pluggable.
Added "Solved" to title. See post below for solution.
On time, cheap, compliant with final specs. Pick two.
In reply to Problems with overriding a Perl::Critic policy - SOLVED by boftx