无法使用策略Perl :: Critic :: Policy :: Tics :: ProhibitLongLines工作

时间:2012-02-10 11:04:30

标签: perl perl-critic

我有:

  • Ubuntu 10.04
  • Perlbrew 0.39
  • 切换到Perl 5.12.3。与perlbrew
  • 安装Perl :: Critic和Perl :: Critic :: Tics with cpanm

我的.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.

感谢您的时间,如果您需要任何其他信息,请与我们联系。

1 个答案:

答案 0 :(得分:1)

这对我来说似乎是个错误。即使我完全忽略了我的.perlcriticrc文件,我也会收到相同的警告:

perlcritic -1 --noprofile mycode.pl

我在perl 5.12.2。

您应该submit a bug report反对Perl::Critic::Tics。我已检查ChangesPerl::CriticTics个文件,但我找不到与String::Format相关的任何内容。确保您拥有最新版本的CriticTics。我有当前Tics(0.006),但我的Critic有点过时(1.111)。