Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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.


Replies are listed 'Best First'.
Re: Perl Critic and a formatting question.
by choroba (Bishop) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-06-21 22:42 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.