.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "criticism 3pm" .TH criticism 3pm "2015-06-05" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" criticism \- Perl pragma to enforce coding standards and best\-practices .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use criticism; \& \& use criticism \*(Aqgentle\*(Aq; \& use criticism \*(Aqstern\*(Aq; \& use criticism \*(Aqharsh\*(Aq; \& use criticism \*(Aqcruel\*(Aq; \& use criticism \*(Aqbrutal\*(Aq; \& \& use criticism ( \-profile => \*(Aq/foo/bar/perlcriticrc\*(Aq ); \& use criticism ( \-severity => 3, \-verbose => \*(Aq%m at %f line %l\*(Aq ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This pragma enforces coding standards and promotes best-practices by running your file through Perl::Critic before every execution. In a production system, this usually isn't feasible because it adds a lot of overhead at start-up. If you have a separate development environment, you can effectively bypass the \f(CW\*(C`criticism\*(C'\fR pragma by not installing Perl::Critic in the production environment. If Perl::Critic can't be loaded, then \f(CW\*(C`criticism\*(C'\fR just fails silently. .PP Alternatively, the \f(CW\*(C`perlcritic\*(C'\fR command-line (which is distributed with Perl::Critic) can be used to analyze your files on-demand and has some additional configuration features. And Test::Perl::Critic provides a nice interface for analyzing files during the build process. .PP If you'd like to try Perl::Critic without installing anything, there is a web-service available at . The web-service does not yet support all the configuration features that are available in the native Perl::Critic \s-1API,\s0 but it should give you a good idea of what it does. You can also invoke the perlcritic web-service from the command line by doing an HTTP-post, such as one of these: .PP .Vb 3 \& $> POST http://perlcritic.com/perl/critic.pl < MyModule.pm \& $> lwp\-request \-m POST http://perlcritic.com/perl/critic.pl < MyModule.pm \& $> wget \-q \-O \- \-\-post\-file=MyModule.pm http://perlcritic.com/perl/critic.pl .Ve .PP Please note that the perlcritic web-service is still alpha code. The \&\s-1URL\s0 and interface to the service are subject to change. .SH "CONFIGURATION" .IX Header "CONFIGURATION" If there is \fBexactly one\fR import argument, then it is taken to be a named equivalent to one of the numeric severity levels supported by Perl::Critic. For example, \f(CW\*(C`use criticism \*(Aqgentle\*(Aq;\*(C'\fR is equivalent to setting the \f(CW\*(C`\-severity => 5\*(C'\fR, which reports only the most dangerous violations. On the other hand, \f(CW\*(C`use criticism \&\*(Aqbrutal\*(Aq;\*(C'\fR is like setting the \f(CW\*(C`\-severity => 1\*(C'\fR, which reports \&\fBevery\fR violation. If there are no import arguments, then it defaults to \f(CW\*(Aqgentle\*(Aq\fR. .PP If there is more than one import argument, then they will all be passed directly into the Perl::Critic constructor. So you can use whatever arguments are supported by Perl::Critic. .PP The \f(CW\*(C`criticism\*(C'\fR pragma will also obey whatever configurations you have set in your \fI.perlcriticrc\fR file. In particular, setting the \&\f(CW\*(C`criticism\-fatal\*(C'\fR option to a true value will cause your program to immediately \f(CW\*(C`die\*(C'\fR if any Perl::Critic violations are found. Otherwise, violations are merely advisory. This option can be set in the global section at the top of your \fI.perlcriticrc\fR file, like this: .PP .Vb 2 \& # Top of your .perlcriticrc file... \& criticism\-fatal = 1 \& \& # per\-policy configurations follow... .Ve .PP You can also pass \f(CW\*(C`(\*(Aq\-criticism\-fatal\*(Aq => 1)\*(C'\fR as import arguments, just like any other Perl::Critic argument. See \*(L"\s-1CONFIGURATION\*(R"\s0 in Perl::Critic for details on the other configuration options. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" Usually, the \f(CW\*(C`criticism\*(C'\fR pragma fails silently if it cannot load Perl::Critic. So by \fBnot\fR installing Perl::Critic in your production environment, you can leave the \f(CW\*(C`criticism\*(C'\fR pragma in your production source code and it will still compile, but it won't be analyzed by Perl::Critic each time it runs. .PP However, if you set the \f(CW\*(C`DEBUG\*(C'\fR environment variable to a true value or run your program under the Perl debugger, you will get a warning when \f(CW\*(C`criticism\*(C'\fR fails to load Perl::Critic. .SH "NOTES" .IX Header "NOTES" The \f(CW\*(C`criticism\*(C'\fR pragma applies to the entire file, so it is not affected by scope or package boundaries and \f(CW\*(C`use\*(C'\fR\-ing it multiple times will just cause it to repeatedly process the same file. There isn't a reciprocal \f(CW\*(C`no criticism\*(C'\fR pragma. However, Perl::Critic does support a pseudo-pragma that directs it to overlook certain lines or blocks of code. See \&\*(L"\s-1BENDING THE RULES\*(R"\s0 in Perl::Critic for more details. .SH "AUTHOR" .IX Header "AUTHOR" Jeffrey Ryan Thalhammer .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2006\-2007 Jeffrey Ryan Thalhammer. All rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the \s-1LICENSE\s0 file included with this module.