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

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.

Thanks

Comment on Perl Critic and a formatting question.
Select or Download Code
Re: Perl Critic and a formatting question.
by choroba (Abbot) 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.

      Děkuji!

      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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-09-18 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls