.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 .. .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 .\" ======================================================================== .\" .IX Title "Perl::Critic::Pulp::Utils 3pm" .TH Perl::Critic::Pulp::Utils 3pm "2021-02-28" "perl v5.32.1" "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::Pulp::Utils \- shared helper code for the Pulp perlcritic add\-on .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Perl::Critic::Pulp::Utils; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a bit of a grab bag, but works as far as it goes. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "Element Functions" .IX Subsection "Element Functions" .ie n .IP """$pkgelem = Perl::Critic::Pulp::Utils::elem_package ($elem)""" 4 .el .IP "\f(CW$pkgelem = Perl::Critic::Pulp::Utils::elem_package ($elem)\fR" 4 .IX Item "$pkgelem = Perl::Critic::Pulp::Utils::elem_package ($elem)" \&\f(CW$elem\fR is a \f(CW\*(C`PPI::Element\*(C'\fR. Return the \f(CW\*(C`PPI::Statement::Package\*(C'\fR containing \f(CW$elem\fR, or \f(CW\*(C`undef\*(C'\fR if \f(CW$elem\fR is not in the scope of any package statement. .Sp The search upwards begins with the element preceding \f(CW$elem\fR, so if \&\f(CW$elem\fR itself is a \f(CW\*(C`PPI::Statement::Package\*(C'\fR then that's not the one returned, instead its containing package. .ie n .IP """$bool = Perl::Critic::Pulp::Utils::elem_in_BEGIN ($elem)""" 4 .el .IP "\f(CW$bool = Perl::Critic::Pulp::Utils::elem_in_BEGIN ($elem)\fR" 4 .IX Item "$bool = Perl::Critic::Pulp::Utils::elem_in_BEGIN ($elem)" Return true if \f(CW$elem\fR (a \f(CW\*(C`PPI::Element\*(C'\fR) is within a \f(CW\*(C`BEGIN\*(C'\fR block (ie. a \f(CW\*(C`PPI::Statement::Scheduled\*(C'\fR of type \*(L"\s-1BEGIN\*(R"\s0). .ie n .IP """$bool = Perl::Critic::Pulp::Utils::elem_is_comma_operator ($elem)""" 4 .el .IP "\f(CW$bool = Perl::Critic::Pulp::Utils::elem_is_comma_operator ($elem)\fR" 4 .IX Item "$bool = Perl::Critic::Pulp::Utils::elem_is_comma_operator ($elem)" Return true if \f(CW$elem\fR (a \f(CW\*(C`PPI::Element\*(C'\fR) is a comma operator (\f(CW\*(C`PPI::Token::Operator\*(C'\fR), either \*(L",\*(R" or "=>'. .SS "Policy Parameter Functions" .IX Subsection "Policy Parameter Functions" .ie n .IP """Perl::Critic::Pulp::Utils::parameter_parse_version ($self, $parameter, $str)""" 4 .el .IP "\f(CWPerl::Critic::Pulp::Utils::parameter_parse_version ($self, $parameter, $str)\fR" 4 .IX Item "Perl::Critic::Pulp::Utils::parameter_parse_version ($self, $parameter, $str)" This is designed for use as the \f(CW\*(C`parser\*(C'\fR field of a policy's \&\f(CW\*(C`supported_parameters\*(C'\fR entry for a parameter which is a version number. .Sp .Vb 5 \& { name => \*(Aqabove_version\*(Aq, \& description => \*(AqCheck only above this version of Perl.\*(Aq, \& behavior => \*(Aqstring\*(Aq, \& parser => \e&Perl::Critic::Pulp::Utils::parameter_parse_version, \& } .Ve .Sp \&\f(CW$str\fR is parsed with the \f(CW\*(C`version.pm\*(C'\fR module. If valid then the parameter is set with \f(CW\*(C`$self\->_\|_set_parameter_value\*(C'\fR to the resulting \&\f(CW\*(C`version\*(C'\fR object (so for example field \f(CW$self\fR\->{'_above_version'}). If invalid then an exception is thrown per \&\f(CW\*(C`$self\->throw_parameter_value_exception\*(C'\fR. .SH "EXPORTS" .IX Header "EXPORTS" Nothing is exported by default, but the functions can be requested in usual \&\f(CW\*(C`Exporter\*(C'\fR style, .PP .Vb 4 \& use Perl::Critic::Pulp::Utils \*(Aqelem_in_BEGIN\*(Aq; \& if (elem_in_BEGIN($elem)) { \& # ... \& } .Ve .PP There's no \f(CW\*(C`:all\*(C'\fR tag since this module is meant as a grab-bag of functions and importing as-yet unknown things would be asking for name clashes. .SH "SEE ALSO" .IX Header "SEE ALSO" Perl::Critic::Pulp, Perl::Critic, \&\s-1PPI\s0 .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2021 Kevin Ryde .PP Perl-Critic-Pulp is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Perl-Critic-Pulp is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Perl-Critic-Pulp. If not, see .