Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Perl Critic and a formatting question.

by Anonymous Monk
on Apr 29, 2013 at 08:05 UTC ( #1031179=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks.

In the following code:

#!\usr\bin\perl package Test20; use strict; use warnings; use autodie; use Fcntl; use version; use Perl::Tidy; use base qw/Exporter/; our @EXPORT_OK = qw/&greet/; our $VERSION = '0.1'; my @data; sysopen FH, 'test.txt', O_RDONLY; @data = <FH>; close FH; for (@data) { exit 1 if !print; } sub greet { my ($name) = shift; return "Hello $name"; } 1;

...perl critic complains about untidy code on column 1, row 1 if run in --brutal "mode". The complaint disappears if I remove the line our @EXPORT_OK = qw/&greet/;

Any suggestions would be appreciated.


Comment on Perl Critic and a formatting question.
Select or Download Code
Replies are listed 'Best First'.
Re: Perl Critic and a formatting question.
by choroba (Canon) on Apr 29, 2013 at 08:27 UTC
    Any suggestions would be appreciated.
    Do not run perlcritic in brutal mode. What's the prize?

    Jokes aside:

    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Hi choroba.


      I should have seen that minor fix but fatigue is the culprit (1:48am here).

      P.S: I hope my rudimentary knowledge of Czech was correct and displayed properly in your browser.


      Oh. I see what the complaint is about and why it disappears! Take a look at these two lines of code:

      our @EXPORT_OK = qw/&greet/; our $VERSION = '0.1';

      The assignment operators (=) don't line up. When perltidy adds the spaces, it's creating whitespace that aligns those operators.

      our @EXPORT_OK = qw/&greet/; our $VERSION = '0.1';

      Now the the code is tidy and the assignment operators are aligned, perlcritic stops complaining.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1031179]
Approved by Corion
Front-paged by toolic
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2015-11-28 14:44 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (742 votes), past polls