Pixel Pedals of Tomakomai

北海道苫小牧市出身の初老の日常

Moose と "Code before strictures are enabled"

Perl::Criticのバージョンが古いと、Mooseを使ってる箇所のテストで「Code before strictures are enabled」が出ます。

うちのバージョンを見たら1.080*1でした。最新バージョンでは、

There are special exemptions for Moose, Moose::Role, and Moose::Util::TypeConstraints because they enforces strictness; e.g. 'use Moose' is treated as equivalent to 'use strict'.

Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict

と素敵仕様に。ただし、他にも MooseX::* のようにstrict強制な物があると思うので、そう言う時は perlcriticrc ファイルに、

[TestingAndDebugging::RequireUseStrict]
equivalent_modules = MooseX::POE

と書きましょう*2

*1:2007-11-11のバージョン

*2:1.080ではこのオプションはないみたい。