Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros3pm
Write "oct(755)" instead of "0755".
Affiliation
This Policy is part of the core Perl::Critic distribution.
Overview
Perl interprets numbers with leading zeros as octal. If that's what you really want, its better to use "oct" and make it obvious.
$var = 041; # not ok, actually 33$var = oct(41); # okchmod 0644, $file; # ok by defaultdbmopen %database, 'foo.db', 0600; # ok by defaultmkdir $directory, 0755; # ok by defaultsysopen $filehandle, $filename, O_RDWR, 0666; # ok by defaultumask 0002; # ok by defaultuse POSIX 'mkfifo';mkfifo $fifo, 0600; # ok by defaultPOSIX::mkfifo $fifo, 0600; # ok by default
Configuration
If you want to ban all leading zeros, set "strict" to a true value in a .perlcriticrc file.
[ValuesAndExpressions::ProhibitLeadingZeros]strict = 1
Releases
10 releases since Debian 5.0 (Lenny); the text changed 9 times.