Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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.


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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (2)
    As of 2018-01-21 13:40 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (228 votes). Check out past polls.