Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic-Tics CPAN distribution.

Report information
The Basics
Id: 74896
Status: resolved
Priority: 0/
Queue: Perl-Critic-Tics

People
Owner: Nobody in particular
Requestors: Alexandros.Kechagias [...] googlemail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.006
Fixed in: (no value)



I have: - Ubuntu 10.04 - Perlbrew 0.39 - Perl::Critic 1.117 I successfully reproduced the error in openSUSE 12.1 with the following steps: 1. I install perlbrew with 'curl -kL http://install.perlbrew.pl | bash' 2. perlbrew install 5.12.3 3. perlbrew switch 5.12.3 4. perlbrew install-cpanm 5. cpanm Perl::Critc 6. cpanm Perl::Critc::Tics 6. create a perl script where one line is long enough to violate the hard length limit of Perl::Critic::Policy::Tics::ProhibitLongLines 7. perlcritic your_script.pl The other policies function as expected but whenever a line violates Perl::Critic::Policy::Tics::ProhibitLongLines I get the following error message: 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.
The String::Formatter use appears to be deep inside Perl::Critic. I have sent the bug to them, as I don't see anything (yet) indicating I've done anything wrong. -- rjbs
This belongs on Perl-Critic-Tics. The ProhibitLongLines policy emits its own custom subclass of Perl::Critic::Violation (not sure I understand why though). At some point, the location() attribute became a 5 element array, consisting of line number, column number, visual column number, logical line number, and logical file name. These correspond the same values in the location() attribute of a PPI::Element. The problem is that the location() attribute of the subclass emitted by ProhibitLongLines only has three values in the array. The easiest way to get the proper location is to just get it from the Element. Then you can diddle with it if you really want to. -Jeff
Instead of taking Jeff's advice, I changed what is stored in the location on the subclass. I don't walk the document tree, so there's no element to look at a line number. The issue is line length, which doesn't really map well to document nodes. I also barely remember how to do Perl::Critic stuff, and hardly use it anymore, so I'm not the best person to make a proper fix, but I figured something is better than nothing. Released new version today. -- rjbs