我有:
我的
.perlcriticrc
文件:
severity = 1
only= 1
[CodeLayout::ProhibitHardTabs]
allow_leading_tabs = 0
[Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines]
[Perl::Critic::Policy::Tics::ProhibitLongLines]
base_max = 120
hard_max = 130
pct_allowed = 5
[Perl::Critic::Policy::OTRS::RequireCamelCase]
其他策略按预期运行,但每当一行超过
hard_max
定义的长度时,我都会收到警告消息:
Use of uninitialized value $min_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $max_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $min_width in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $replacement in concatenation (.) or string at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
这对我来说似乎是一个错误。即使我完全忽略我的
.perlcriticrc
文件,我也会收到相同的警告:
perlcritic -1 --noprofile mycode.pl
我使用的是 Perl 5.12.2。
您应该针对 Perl::Critic::Tics 提交错误报告。我已经检查了
Changes
和 Perl::Critic的
Tics
文件,但没有找到与 String::Format
相关的任何内容。确保您拥有最新版本的 Critic
和 Tics
。我有当前的 Tics
(0.006),但我的 Critic
有点过时了 (1.111)。