UPDATE:
I try ## no critic (Modules::RequireExplicitPackage) at end of first line, but it don't help - error appear for next line
When I add ## no critic (Modules::RequireExplicitPackage) before the first line, the Code not contained in explicit package.  Violates encapsulation message disappears for me:
## no critic (Modules::RequireExplicitPackage) use lib qw( lib ); use strict; use warnings; use Test::More tests => 1;

This was my original response...


According to the POD for Perl::Critic::Policy::Modules::RequireExplicitPackage, there are no hooks for disabling this check. However, it does say:

so this Policy doesn't apply to files that begin with a perl shebang.
If you add a shebang line to your test file, the check is suppressed:
#!/usr/bin/env perl
If you don't want to do that, then you could just post-process the output of perlcritic and filter out these messages.

You can also request that this feature be added to the module at https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic. Better yet, figure out how to modify the module yourself and submit a patch (that increases the chances of having the feature added).


In reply to Re: perlcritic & test files by toolic
in thread perlcritic & test files by Bor

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!
  • 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, details, 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, summary, 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.