🌻 📖 Perl::Critic::Policy::Plicease::ProhibitLeadingZeros

NAME

Perl::Critic::Policy::Plicease::ProhibitLeadingZeros - Leading zeroes are okay as the first arg to chmod, and other such reasonableness

VERSION

version 0.04

DESCRIPTION

This is a stupid mistake:

 my $x = 1231;
 my $y = 2345;
 my $z = 0032;

This is not:

 chmod 0700, "secret_file.txt";

Neither is this:

 use File::Path qw( mkpath );
 
 mkpath("/foo/bar/baz", 1, 0700);

Nor is this:

 use Path::Class qw( dir );
 
 dir()->mkpath(1,0700);

CAVEATS

Because mkpath is not a built in (as chmod is), this policy does not differentiate between the mkpath function provided by File::Path or the mkpath method provided by Path::Class::Dir and arbitrary mkpath function or methods that you or someone else might define. Also, there is no way to really check if the object invocant of a mkpath method is really an instance of Path::Class::Dir.

SEE ALSO

This policy is based largely on the existing in-core policy, and one in the lax bundle, but adds a few exceptions that I find useful.

Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros
Perl::Critic::Policy::Lax::ProhibitLeadingZeros::ExceptChmod

AUTHOR

Author: Graham Ollis <plicease@cpan.org>

Contributors:

Ville Skyttä (SCOP)

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.