|There's more than one way to do things|
Re: Problems with overriding a Perl::Critic policy - SOLVEDby boftx (Deacon)
|on Sep 22, 2013 at 21:57 UTC||Need Help??|
Thanks to a nudge from the post above (thanks!) I tried delegating to Subroutines::RequireArgUnpacking instead of sub-classing and now I can exclude that one but have my policy still execute.
Here is the gist of the technique I used. Please keep in mind that this is strictly proof of concept at this point. I will post the final code to Meditations when it is done as an RFC. I know already that I will want further suggestions on how to fine tune the regex expressions being used as well as how to go about integrating the existing P::C test harness for regression tests.
Corrected items in the arrays at the top.
Before someone asks, yes, I could have done the delegation much easier with Moose. I decided against that because Perl::Critic does not use Moose and is 5.6 compliant. I wanted to keep anything I added the same if it is eventually released to CPAN.
Second, I did not use AUTOLOAD for two reasons: a) anything that depends upon using a "obj->can()" test would fail, and b) I had to have two different types of delegation based on whether or not the call would be to a simple sub-routine or an object method call (passing in the object as the first element.)
On time, cheap, compliant with final specs. Pick two.