Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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.

Update

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (3)
    As of 2014-09-20 04:34 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

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











      Results (152 votes), past polls