[Chicago-talk] A Perl::Critic question

Mike Fragassi frag at ripco.com
Mon Apr 12 11:44:40 PDT 2010


Elliot --

Thanks very much for that explanation; it really clears up a few 
misunderstandings I had.  I think it's because of the following bit of 
POD, unless I'm still missing something.

    The "## no critic" annotations direct Perl::Critic to ignore the
    remaining lines of code _until the end of the current block_,
    or until a "## use critic" annotation is found (whichever comes first).

-- Mike F.

On Sat, 10 Apr 2010, Elliot Shank wrote:

> The first form of P::C directive is one that is located on a line by itself. 
> It is then in effect to the end of the document or to the next "## use 
> critic" directive.
>
>    sub foo {
>        ...
>        for (...) {
>            ...
>            if (...) {
>                ## no critic (ProhibitMagicNumbers)
>                ...
>            }
>            ...
>        }
>        ...
>    }
>
>    sub bar {
>        ...
>        while (...) {
>            ...
>            ## use critic
>            ...
>        }
>        ...
>    }
>
> Assuming that there aren't any other P::C directives, ProhibitMagicNumbers is 
> disabled for all elements with positions between the two directives; that the 
> directives are nested within various levels of and cross between blocks 
> doesn't mean anything.



More information about the Chicago-talk mailing list