Perl::...gZeros(3pm)
π NAME π
okay so this is the Perl::...gZeros(3pm) manual, filed under User Contributed Perl Documentation, and the full policy name is Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros. Its whole thing? Write oct(755) instead of 0755. Slay. π
π¦ AFFILIATION π¦
This Policy is part of the core Perl::Critic distribution, periodt β it's not some random side quest. π«Ά
β¨ DESCRIPTION β¨
Perl interprets numbers with leading zeros as octal, bestie. That's the vibe check. If that's genuinely what you really want, it's better to use oct and make it obvious. No cap. π
$var = 041; # not ok, actually 33
$var = oct(41); # ok
chmod 0644, $file; # ok by default
dbmopen %database, 'foo.db', 0600; # ok by default
mkdir $directory, 0755; # ok by default
sysopen $filehandle, $filename, O_RDWR, 0666; # ok by default
umask 0002; # ok by default
use POSIX 'mkfifo';
mkfifo $fifo, 0600; # ok by default
POSIX::mkfifo $fifo, 0600; # ok by default
Those # ok by default comments are literally the policy being like "this one's fine, bestie." π
π CONFIGURATION π
If you want to ban all leading zeros β like, all of them β set strict to a true value in a .perlcriticrc file. It's giving "no zeros allowed at the function." β¨
[ValuesAndExpressions::ProhibitLeadingZeros]
strict = 1
πΈ AUTHOR πΈ
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β iconic, honestly. π
π COPYRIGHT π
Copyright (c) 2005-2023 Imaginative Software Systems. All rights reserved.
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 LICENSE file included with this module.
okay bye bestie! This page is from perl v5.42.0, dated 2024-10-23, and it's the Perl::...gZeros(3pm) manual. Drink water, chmod responsibly, and remember: if you meant octal, say oct. ππ¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms