.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" 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 >0, 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 .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" 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 "Perl::Critic::Policy::Variables::ProhibitEvilVariables 3pm" .TH Perl::Critic::Policy::Variables::ProhibitEvilVariables 3pm "2018-07-27" "perl v5.26.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" Perl::Critic::Policy::Variables::ProhibitEvilVariables \- Ban variables that aren't blessed by your shop. .SH "AFFILIATION" .IX Header "AFFILIATION" This Policy is part of the core Perl::Critic distribution. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Use this policy if you wish to prohibit the use of specific variables. These may be global variables warned against in \f(CW\*(C`perlvar\*(C'\fR, or just variables whose names you do not like. .SH "CONFIGURATION" .IX Header "CONFIGURATION" The set of prohibited variables is configurable via the \f(CW\*(C`variables\*(C'\fR and \&\f(CW\*(C`variables_file\*(C'\fR options. .PP The value of \f(CW\*(C`variables\*(C'\fR should be a string of space-delimited, fully qualified variable names and/or regular expressions. An example of prohibiting two specific variables in a \fI.perlcriticrc\fR file: .PP .Vb 2 \& [Variables::ProhibitEvilVariables] \& variables = $[ $^S $SIG{_\|_DIE_\|_} .Ve .PP If you prohibit an array or hash (e.g. \f(CW@INC\fR), use of elements of the array or hash will be prohibited as well. If you specify a subscripted variable (e.g. \&\f(CW$SIG{_\|_DIE_\|_}\fR), only the literal subscript specified will be detected. The above <.perlcritic> file, for example, will cause \f(CW\*(C`perlcritic (1)\*(C'\fR to detect \&\f(CW\*(C`$SIG{_\|_DIE_\|_} = \e&foo\*(C'\fR, but not .PP .Vb 2 \& my $foo = \*(Aq_\|_DIE_\|_\*(Aq; \& $SIG{$foo} = \e&foo; .Ve .PP Regular expressions are identified by values beginning and ending with slashes. Any variable with a name that matches \f(CW\*(C`m/pattern/sm\*(C'\fR will be forbidden. For example: .PP .Vb 2 \& [Variables::ProhibitEvilVariables] \& variables = /acme/ .Ve .PP would cause all variables that match \f(CW\*(C`m/acme/\*(C'\fR to be forbidden. If you want a case-blind check, you can use (?i: ... ). For example .PP .Vb 2 \& [Variables::ProhibitEvilVariables] \& variables = /(?i:acme)/ .Ve .PP forbids variables that match \f(CW\*(C`m/acme/smi\*(C'\fR. .PP In addition, you can override the default message (\*(L"Prohibited variable \&\*(R"\fIvariable\fR\*(L" used\*(R") with your own, in order to give suggestions for alternative action. To do so, put your message in curly braces after the variable name or regular expression. Like this: .PP .Vb 2 \& [Variables::ProhibitEvilVariables] \& variables = $[ {Found use of $[. Program to base index 0 instead} .Ve .PP If your message contains curly braces, you can enclose it in parentheses, angle brackets, or square brackets instead. .PP Similarly, the \f(CW\*(C`variables_file\*(C'\fR option gives the name of a file containing specifications for prohibited variables. Only one variable specification is allowed per line and comments start with an octothorp and run to end of line; no curly braces are necessary for delimiting messages: .PP .Vb 1 \& $[ # Prohibit the "$[" variable and use the default message. \& \& # Prohibit the "$^S" variable and give a replacement message. \& $^S Having to think about $^S in exception handlers is just wrong \& \& # Use a regular expression. \& /acme/ No coyotes allowed. .Ve .PP By default, there are no prohibited variables, although I can think of a few that should be. See \f(CW\*(C`perldoc perlvar\*(C'\fR for a few suggestions. .SH "RESTRICTIONS" .IX Header "RESTRICTIONS" Variables of the form \f(CW\*(C`${^foo}\*(C'\fR are not recognized by \s-1PPI\s0 as of version 1.206. When \s-1PPI\s0 recognizes these, this policy will Just Work for them too. .PP Only direct references to prohibited variables and literal subscripts will be recognized. For example, if you prohibit $[, the first line in .PP .Vb 2 \& my $foo = \e$[; \& $$foo = 1; .Ve .PP will be flagged as a violation, but not the second, even though the second, in fact, assigns to $[. Similarly, if you prohibit \f(CW$SIG\fR{_\|_DIE_\|_}, this policy will not recognize .PP .Vb 2 \& my $foo = \*(Aq_\|_DIE_\|_\*(Aq; \& $SIG{$foo} = sub {warn \*(AqI cannot die!\*(Aq}; .Ve .PP as an assignment to \f(CW$SIG\fR{_\|_DIE_\|_}. .SH "NOTES" .IX Header "NOTES" This policy leans heavily on Perl::Critic::Policy::Modules::ProhibitEvilModules by Jeffrey Ryan Thalhammer. .SH "AUTHOR" .IX Header "AUTHOR" Thomas R. Wyant, \s-1III\s0 \fIwyant at cpan dot org\fR .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2009\-2011 Thomas R. Wyant, \s-1III\s0 .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.