The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Search results for "dist:Perl-Critic CDOLAN"

Perl::Critic::Document - Caching wrapper around a PPI::Document. River stage three • 131 direct dependents • 408 total dependents

Perl::Critic does a lot of iterations over the PPI document tree via the "PPI::Document::find()" method. To save some time, this class pre-caches a lot of the common "find()" calls in a single traversal. Then, on subsequent requests we return the cac...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::TestUtils - Utility functions for testing new Policies. River stage three • 131 direct dependents • 408 total dependents

This module is used by Perl::Critic only for self-testing. It provides a few handy subroutines for testing new Perl::Critic::Policy modules. Look at the test programs that ship with Perl::Critic for more examples of how to use these subroutines....

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Documentation::PodSpelling - Check your spelling. River stage three • 131 direct dependents • 408 total dependents

Did you write the documentation? Check. Did you document all of the public methods? Check. Is your documentation readable? Hmm... Ideally, we'd like Perl::Critic to tell you when your documentation is inadequate. That's hard to code, though. So, insp...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Modules::RequireEndWithOne - End each module with an explicitly 1; instead of some funky expression. River stage three • 131 direct dependents • 408 total dependents

All files included via "use" or "require" must end with a true value to indicate to the caller that the include was successful. The standard practice is to conclude your .pm files with "1;", but some authors like to get clever and return some other t...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::InputOutput::RequireBriefOpen - Close filehandles as soon as possible after opening them. River stage three • 131 direct dependents • 408 total dependents

One way that production systems fail unexpectedly is by running out of filehandles. Filehandles are a finite resource on every operating system that I'm aware of, and running out of them is virtually impossible to recover from. The solution is to not...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Variables::ProhibitMatchVars - Avoid $`, $&, $' and their English equivalents. River stage three • 131 direct dependents • 408 total dependents

Using the "match variables" $`, $&, and/or $' can significantly degrade the performance of a program. This policy forbids using them or their English equivalents. See perldoc English or PBP page 82 for more information. It used to forbid plain "use E...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Subroutines::ProhibitManyArgs - Too many arguments. River stage three • 131 direct dependents • 408 total dependents

Subroutines that expect large numbers of arguments are hard to use because programmers routinely have to look at documentation to remember the order of those arguments. Many arguments is often a sign that a subroutine should be refactored or that an ...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Variables::ProtectPrivateVars - Prevent access to private vars in other packages. River stage three • 131 direct dependents • 408 total dependents

By convention Perl authors (like authors in many other languages) indicate private methods and variables by inserting a leading underscore before the identifier. This policy catches attempts to access private variables from outside the package itself...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Variables::ProhibitReusedNames - Do not reuse a variable name in a lexical scope River stage three • 131 direct dependents • 408 total dependents

It's really hard on future maintenance programmers if you reuse a variable name in a lexical scope. The programmer is at risk of confusing which variable is which. And, worse, the programmer could accidentally remove the inner declaration, thus silen...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Documentation::RequirePodAtEnd - All POD should be after __END__. River stage three • 131 direct dependents • 408 total dependents

Perl stops processing code when it sees an "__END__" statement. So, to save processing time, it's faster to put documentation after the "__END__". Also, writing all the POD in one place usually leads to a more cohesive document, rather than being for...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Subroutines::RequireFinalReturn - End every path through a subroutine with an explicit return statement. River stage three • 131 direct dependents • 408 total dependents

Require all subroutines to terminate explicitly with one of the following: "return", "carp", "croak", "die", "exec", "exit", "goto", or "throw". Subroutines without explicit return statements at their ends can be confusing. It can be challenging to d...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Subroutines::ProtectPrivateSubs - Prevent access to private subs in other packages. River stage three • 131 direct dependents • 408 total dependents

By convention Perl authors (like authors in many other languages) indicate private methods and variables by inserting a leading underscore before the identifier. This policy catches attempts to access private variables from outside the package itself...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Subroutines::RequireArgUnpacking - Always unpack @_ first. River stage three • 131 direct dependents • 408 total dependents

Subroutines that use @_ directly instead of unpacking the arguments to local variables first have two major problems. First, they are very hard to read. If you're going to refer to your variables by number instead of by name, you may as well be writi...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Modules::RequireBarewordIncludes - Write require Module instead of require 'Module.pm'. River stage three • 131 direct dependents • 408 total dependents

When including another module (or library) via the "require" or "use" statements, it is best to identify the module (or library) using a bareword rather than an explicit path. This is because paths are usually not portable from one machine to another...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::Variables::RequireNegativeIndices - Negative array index should be used. River stage three • 131 direct dependents • 408 total dependents

Perl treats a negative array subscript as an offset from the end. Given this, the preferred way to get the last element is $x[-1], not $x[$#x] or $x[@x-1], and the preferred way to get the next-to-last is $x[-2], not "$x[$#x-1" or $x[@x-2]. The bigge...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin - Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>". River stage three • 131 direct dependents • 408 total dependents

Perl has a useful magic filehandle called *ARGV that checks the command line and if there are any arguments, opens and reads those as files. If there are no arguments, *ARGV behaves like *STDIN instead. This behavior is almost always what you want if...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls - Return value of flagged function ignored. River stage three • 131 direct dependents • 408 total dependents

This performs identically to InputOutput::RequireCheckedOpen/Close except that this is configurable to apply to any function, whether core or user-defined. If your module uses Fatal, Fatal::Exception, or autodie then any functions wrapped by those mo...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline - Use local $/ = undef or Path::Tiny instead of joined readline. River stage three • 131 direct dependents • 408 total dependents

It's really easy to slurp a whole filehandle in at once with "join q{}, <$fh">, but that's inefficient -- Perl goes to the trouble of splitting the file into lines only to have that work thrown away. To save performance, either slurp the filehandle w...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep - Use any from List::Util, List::SomeUtils, or List::MoreUtils instead of grep in boolean context. River stage three • 131 direct dependents • 408 total dependents

Using "grep" in boolean context is a common idiom for checking if any elements in a list match a condition. This works because boolean context is a subset of scalar context, and grep returns the number of matches in scalar context. A non-zero number ...

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC

Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest - Use prompt() instead of -t. River stage three • 131 direct dependents • 408 total dependents

The "-t" operator is fragile and complicated. When you are testing whether "STDIN" is interactive, It's much more robust to use well-tested CPAN modules like IO::Interactive....

PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC
46 results (0.028 seconds)