Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl::Critic 'Code before strictures' when using Modern::Perl

I understand that it is best practice to use Modern::Perl rather than use strict and warnings.

With default options, Perl::Critic v1.121 complains about code before strict, even when 'use Modern::Perl' comes before code.

QUESTION: Is the best solution to update the perlcriticrc config like below, or is there a better way?

Source of config below

cat ~/.perlcriticrc

[TestingAndDebugging::RequireUseStrict]
equivalent_modules = Modern::Perl

[TestingAndDebugging::RequireUseWarnings]
equivalent_modules = Modern::Perl

Also of note: Developer Discussion Here

like image 977
null Avatar asked Aug 12 '14 06:08

null


1 Answers

You can "use 5.014" (or higher if available) to implicitly enable "use strict" right in the first line. Perl::Critic likes this native approach much more. After that you are free to still invoke use Modern::Perl if you still feel the need.

like image 174
Ralf Avatar answered Oct 12 '22 23:10

Ralf