Perl::Critic(perlcritic)を使用して静的解析、コーディング規約テストを実施(準備編)

Perlの静的解析、コーディング規約テストを実施する為にPerl::Criticを使用する事になったので、内容を残しておきます。

dockerのubuntuにて実行
「Ubuntu 14.04.3 LTS」
(実行日付：2017/02/26)


## apt-getアップデート
コマンド：
apt-get update

(実行結果)

```
# apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Hit http://archive.ubuntu.com trusty Release.gpg     
Hit http://archive.ubuntu.com trusty Release         
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [485 kB]           
Get:4 http://archive.ubuntu.com trusty-updates/restricted Sources [5957 B]     
Get:5 http://archive.ubuntu.com trusty-updates/universe Sources [220 kB]       
Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1197 kB]   
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [20.4 kB]
Get:8 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [516 kB]
Get:9 http://archive.ubuntu.com trusty-security/main Sources [160 kB]          
Get:10 http://archive.ubuntu.com trusty-security/restricted Sources [4667 B]   
Get:11 http://archive.ubuntu.com trusty-security/universe Sources [59.4 kB]    
Get:12 http://archive.ubuntu.com trusty-security/main amd64 Packages [730 kB]  
Get:13 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [17.0 kB]
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [199 kB]
Hit http://archive.ubuntu.com trusty/main Sources                              
Hit http://archive.ubuntu.com trusty/restricted Sources                        
Hit http://archive.ubuntu.com trusty/universe Sources                          
Hit http://archive.ubuntu.com trusty/main amd64 Packages                       
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages                 
Hit http://archive.ubuntu.com trusty/universe amd64 Packages                   
Fetched 3745 kB in 30s (122 kB/s)                                              
Reading package lists... Done
```

## Perl::Criticインストール
コマンド：
apt-get install libperl-critic-perl

(実行結果)

```
# apt-get install libperl-critic-perl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libb-keywords-perl libclass-data-inheritable-perl libclass-inspector-perl
  libclass-method-modifiers-perl libclass-tiny-perl libclone-perl
  libconfig-tiny-perl libdata-optlist-perl libdevel-stacktrace-perl
  libemail-address-perl libexception-class-perl libfile-homedir-perl
  libfile-sharedir-perl libfile-sharedir-projectdistdir-perl
  libfile-slurp-perl libfile-which-perl libio-string-perl
  liblingua-en-inflect-perl liblist-moreutils-perl libmodule-runtime-perl
  libparams-classify-perl libparams-util-perl libpath-class-perl
  libpath-finddev-perl libpath-isdev-perl libpath-tiny-perl libpod-spell-perl
  libppi-perl libppix-regexp-perl libppix-utilities-perl libreadonly-perl
  libreadonly-xs-perl librole-tiny-perl libstring-format-perl
  libsub-exporter-perl libsub-install-perl libtask-weaken-perl
  libunicode-utf8-perl perltidy
Suggested packages:
  libscalar-number-perl
The following NEW packages will be installed:
  libb-keywords-perl libclass-data-inheritable-perl libclass-inspector-perl
  libclass-method-modifiers-perl libclass-tiny-perl libclone-perl
  libconfig-tiny-perl libdata-optlist-perl libdevel-stacktrace-perl
  libemail-address-perl libexception-class-perl libfile-homedir-perl
  libfile-sharedir-perl libfile-sharedir-projectdistdir-perl
  libfile-slurp-perl libfile-which-perl libio-string-perl
  liblingua-en-inflect-perl liblist-moreutils-perl libmodule-runtime-perl
  libparams-classify-perl libparams-util-perl libpath-class-perl
  libpath-finddev-perl libpath-isdev-perl libpath-tiny-perl
  libperl-critic-perl libpod-spell-perl libppi-perl libppix-regexp-perl
  libppix-utilities-perl libreadonly-perl libreadonly-xs-perl
  librole-tiny-perl libstring-format-perl libsub-exporter-perl
  libsub-install-perl libtask-weaken-perl libunicode-utf8-perl perltidy
0 upgraded, 40 newly installed, 0 to remove and 81 not upgraded.
Need to get 2716 kB of archives.
After this operation, 8616 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libb-keywords-perl all 1.13-1 [11.3 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main libclass-data-inheritable-perl all 0.08-2 [8774 B]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main libclass-inspector-perl all 1.28-1 [18.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main libclass-method-modifiers-perl all 2.09-1 [15.2 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty/main libclass-tiny-perl all 0.012-1 [14.9 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty/main libclone-perl amd64 0.36-1 [11.0 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty/main libconfig-tiny-perl all 2.20-1 [13.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty/main libparams-util-perl amd64 1.07-1build1 [22.4 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ trusty/main libsub-install-perl all 0.927-1 [10.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ trusty/main libdata-optlist-perl all 0.109-1 [9920 B]
Get:11 http://archive.ubuntu.com/ubuntu/ trusty/main libdevel-stacktrace-perl all 1.3000-1 [19.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ trusty/main libemail-address-perl all 1.900-1 [25.7 kB]
Get:13 http://archive.ubuntu.com/ubuntu/ trusty/main libexception-class-perl all 1.37-1 [25.9 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ trusty/main libfile-which-perl all 1.09-1 [11.6 kB]
Get:15 http://archive.ubuntu.com/ubuntu/ trusty/main libfile-homedir-perl all 1.00-1 [46.0 kB]
Get:16 http://archive.ubuntu.com/ubuntu/ trusty/main libfile-sharedir-perl all 1.03-1 [12.0 kB]
Get:17 http://archive.ubuntu.com/ubuntu/ trusty/main libpath-class-perl all 0.33-1 [37.2 kB]
Get:18 http://archive.ubuntu.com/ubuntu/ trusty/main libparams-classify-perl amd64 0.013-4build2 [23.0 kB]
Get:19 http://archive.ubuntu.com/ubuntu/ trusty/main libmodule-runtime-perl all 0.013-1 [15.8 kB]
Get:20 http://archive.ubuntu.com/ubuntu/ trusty/main libpath-tiny-perl all 0.052-1 [36.9 kB]
Get:21 http://archive.ubuntu.com/ubuntu/ trusty/main librole-tiny-perl all 1.003002-1 [17.8 kB]
Get:22 http://archive.ubuntu.com/ubuntu/ trusty/main libsub-exporter-perl all 0.986-1 [50.6 kB]
Get:23 http://archive.ubuntu.com/ubuntu/ trusty/main libpath-isdev-perl all 1.000002-1 [78.2 kB]
Get:24 http://archive.ubuntu.com/ubuntu/ trusty/main libpath-finddev-perl all 0.4.0-1 [12.3 kB]
Get:25 http://archive.ubuntu.com/ubuntu/ trusty/main libfile-sharedir-projectdistdir-perl all 0.5.2-1 [12.8 kB]
Get:26 http://archive.ubuntu.com/ubuntu/ trusty/main libio-string-perl all 1.08-3 [11.1 kB]
Get:27 http://archive.ubuntu.com/ubuntu/ trusty/main liblingua-en-inflect-perl all 1.895-1 [52.5 kB]
Get:28 http://archive.ubuntu.com/ubuntu/ trusty/main liblist-moreutils-perl amd64 0.33-1build3 [48.5 kB]
Get:29 http://archive.ubuntu.com/ubuntu/ trusty/main libfile-slurp-perl all 9999.19-4 [41.3 kB]
Get:30 http://archive.ubuntu.com/ubuntu/ trusty/main libpod-spell-perl all 1.12-1 [30.2 kB]
Get:31 http://archive.ubuntu.com/ubuntu/ trusty/main libtask-weaken-perl all 1.04-1 [7628 B]
Get:32 http://archive.ubuntu.com/ubuntu/ trusty/main libppi-perl all 1.215-1 [381 kB]
Get:33 http://archive.ubuntu.com/ubuntu/ trusty/main libppix-regexp-perl all 0.036-1 [223 kB]
Get:34 http://archive.ubuntu.com/ubuntu/ trusty/main libreadonly-perl all 1.04-1 [16.6 kB]
Get:35 http://archive.ubuntu.com/ubuntu/ trusty/main libppix-utilities-perl all 1.001000-1 [17.9 kB]
Get:36 http://archive.ubuntu.com/ubuntu/ trusty/main libreadonly-xs-perl amd64 1.05-1 [9908 B]
Get:37 http://archive.ubuntu.com/ubuntu/ trusty/main libstring-format-perl all 1.17-1 [9876 B]
Get:38 http://archive.ubuntu.com/ubuntu/ trusty/main perltidy all 20120701-1 [351 kB]
Get:39 http://archive.ubuntu.com/ubuntu/ trusty/main libperl-critic-perl all 1.121-1 [935 kB]
Get:40 http://archive.ubuntu.com/ubuntu/ trusty/main libunicode-utf8-perl amd64 0.59-1build1 [19.5 kB]
Fetched 2716 kB in 16s (164 kB/s)                                              
Extracting templates from packages: 100%
Selecting previously unselected package libb-keywords-perl.
(Reading database ... 15918 files and directories currently installed.)
Preparing to unpack .../libb-keywords-perl_1.13-1_all.deb ...
Unpacking libb-keywords-perl (1.13-1) ...
Selecting previously unselected package libclass-data-inheritable-perl.
Preparing to unpack .../libclass-data-inheritable-perl_0.08-2_all.deb ...
Unpacking libclass-data-inheritable-perl (0.08-2) ...
Selecting previously unselected package libclass-inspector-perl.
Preparing to unpack .../libclass-inspector-perl_1.28-1_all.deb ...
Unpacking libclass-inspector-perl (1.28-1) ...
Selecting previously unselected package libclass-method-modifiers-perl.
Preparing to unpack .../libclass-method-modifiers-perl_2.09-1_all.deb ...
Unpacking libclass-method-modifiers-perl (2.09-1) ...
Selecting previously unselected package libclass-tiny-perl.
Preparing to unpack .../libclass-tiny-perl_0.012-1_all.deb ...
Unpacking libclass-tiny-perl (0.012-1) ...
Selecting previously unselected package libclone-perl.
Preparing to unpack .../libclone-perl_0.36-1_amd64.deb ...
Unpacking libclone-perl (0.36-1) ...
Selecting previously unselected package libconfig-tiny-perl.
Preparing to unpack .../libconfig-tiny-perl_2.20-1_all.deb ...
Unpacking libconfig-tiny-perl (2.20-1) ...
Selecting previously unselected package libparams-util-perl.
Preparing to unpack .../libparams-util-perl_1.07-1build1_amd64.deb ...
Unpacking libparams-util-perl (1.07-1build1) ...
Selecting previously unselected package libsub-install-perl.
Preparing to unpack .../libsub-install-perl_0.927-1_all.deb ...
Unpacking libsub-install-perl (0.927-1) ...
Selecting previously unselected package libdata-optlist-perl.
Preparing to unpack .../libdata-optlist-perl_0.109-1_all.deb ...
Unpacking libdata-optlist-perl (0.109-1) ...
Selecting previously unselected package libdevel-stacktrace-perl.
Preparing to unpack .../libdevel-stacktrace-perl_1.3000-1_all.deb ...
Unpacking libdevel-stacktrace-perl (1.3000-1) ...
Selecting previously unselected package libemail-address-perl.
Preparing to unpack .../libemail-address-perl_1.900-1_all.deb ...
Unpacking libemail-address-perl (1.900-1) ...
Selecting previously unselected package libexception-class-perl.
Preparing to unpack .../libexception-class-perl_1.37-1_all.deb ...
Unpacking libexception-class-perl (1.37-1) ...
Selecting previously unselected package libfile-which-perl.
Preparing to unpack .../libfile-which-perl_1.09-1_all.deb ...
Unpacking libfile-which-perl (1.09-1) ...
Selecting previously unselected package libfile-homedir-perl.
Preparing to unpack .../libfile-homedir-perl_1.00-1_all.deb ...
Unpacking libfile-homedir-perl (1.00-1) ...
Selecting previously unselected package libfile-sharedir-perl.
Preparing to unpack .../libfile-sharedir-perl_1.03-1_all.deb ...
Unpacking libfile-sharedir-perl (1.03-1) ...
Selecting previously unselected package libpath-class-perl.
Preparing to unpack .../libpath-class-perl_0.33-1_all.deb ...
Unpacking libpath-class-perl (0.33-1) ...
Selecting previously unselected package libparams-classify-perl.
Preparing to unpack .../libparams-classify-perl_0.013-4build2_amd64.deb ...
Unpacking libparams-classify-perl (0.013-4build2) ...
Selecting previously unselected package libmodule-runtime-perl.
Preparing to unpack .../libmodule-runtime-perl_0.013-1_all.deb ...
Unpacking libmodule-runtime-perl (0.013-1) ...
Selecting previously unselected package libpath-tiny-perl.
Preparing to unpack .../libpath-tiny-perl_0.052-1_all.deb ...
Unpacking libpath-tiny-perl (0.052-1) ...
Selecting previously unselected package librole-tiny-perl.
Preparing to unpack .../librole-tiny-perl_1.003002-1_all.deb ...
Unpacking librole-tiny-perl (1.003002-1) ...
Selecting previously unselected package libsub-exporter-perl.
Preparing to unpack .../libsub-exporter-perl_0.986-1_all.deb ...
Unpacking libsub-exporter-perl (0.986-1) ...
Selecting previously unselected package libpath-isdev-perl.
Preparing to unpack .../libpath-isdev-perl_1.000002-1_all.deb ...
Unpacking libpath-isdev-perl (1.000002-1) ...
Selecting previously unselected package libpath-finddev-perl.
Preparing to unpack .../libpath-finddev-perl_0.4.0-1_all.deb ...
Unpacking libpath-finddev-perl (0.4.0-1) ...
Selecting previously unselected package libfile-sharedir-projectdistdir-perl.
Preparing to unpack .../libfile-sharedir-projectdistdir-perl_0.5.2-1_all.deb ...
Unpacking libfile-sharedir-projectdistdir-perl (0.5.2-1) ...
Selecting previously unselected package libio-string-perl.
Preparing to unpack .../libio-string-perl_1.08-3_all.deb ...
Unpacking libio-string-perl (1.08-3) ...
Selecting previously unselected package liblingua-en-inflect-perl.
Preparing to unpack .../liblingua-en-inflect-perl_1.895-1_all.deb ...
Unpacking liblingua-en-inflect-perl (1.895-1) ...
Selecting previously unselected package liblist-moreutils-perl.
Preparing to unpack .../liblist-moreutils-perl_0.33-1build3_amd64.deb ...
Unpacking liblist-moreutils-perl (0.33-1build3) ...
Selecting previously unselected package libfile-slurp-perl.
Preparing to unpack .../libfile-slurp-perl_9999.19-4_all.deb ...
Unpacking libfile-slurp-perl (9999.19-4) ...
Selecting previously unselected package libpod-spell-perl.
Preparing to unpack .../libpod-spell-perl_1.12-1_all.deb ...
Unpacking libpod-spell-perl (1.12-1) ...
Selecting previously unselected package libtask-weaken-perl.
Preparing to unpack .../libtask-weaken-perl_1.04-1_all.deb ...
Unpacking libtask-weaken-perl (1.04-1) ...
Selecting previously unselected package libppi-perl.
Preparing to unpack .../libppi-perl_1.215-1_all.deb ...
Unpacking libppi-perl (1.215-1) ...
Selecting previously unselected package libppix-regexp-perl.
Preparing to unpack .../libppix-regexp-perl_0.036-1_all.deb ...
Unpacking libppix-regexp-perl (0.036-1) ...
Selecting previously unselected package libreadonly-perl.
Preparing to unpack .../libreadonly-perl_1.04-1_all.deb ...
Unpacking libreadonly-perl (1.04-1) ...
Selecting previously unselected package libppix-utilities-perl.
Preparing to unpack .../libppix-utilities-perl_1.001000-1_all.deb ...
Unpacking libppix-utilities-perl (1.001000-1) ...
Selecting previously unselected package libreadonly-xs-perl.
Preparing to unpack .../libreadonly-xs-perl_1.05-1_amd64.deb ...
Unpacking libreadonly-xs-perl (1.05-1) ...
Selecting previously unselected package libstring-format-perl.
Preparing to unpack .../libstring-format-perl_1.17-1_all.deb ...
Unpacking libstring-format-perl (1.17-1) ...
Selecting previously unselected package perltidy.
Preparing to unpack .../perltidy_20120701-1_all.deb ...
Unpacking perltidy (20120701-1) ...
Selecting previously unselected package libperl-critic-perl.
Preparing to unpack .../libperl-critic-perl_1.121-1_all.deb ...
Unpacking libperl-critic-perl (1.121-1) ...
Selecting previously unselected package libunicode-utf8-perl.
Preparing to unpack .../libunicode-utf8-perl_0.59-1build1_amd64.deb ...
Unpacking libunicode-utf8-perl (0.59-1build1) ...
Setting up libb-keywords-perl (1.13-1) ...
Setting up libclass-data-inheritable-perl (0.08-2) ...
Setting up libclass-inspector-perl (1.28-1) ...
Setting up libclass-method-modifiers-perl (2.09-1) ...
Setting up libclass-tiny-perl (0.012-1) ...
Setting up libclone-perl (0.36-1) ...
Setting up libconfig-tiny-perl (2.20-1) ...
Setting up libparams-util-perl (1.07-1build1) ...
Setting up libsub-install-perl (0.927-1) ...
Setting up libdata-optlist-perl (0.109-1) ...
Setting up libdevel-stacktrace-perl (1.3000-1) ...
Setting up libemail-address-perl (1.900-1) ...
Setting up libexception-class-perl (1.37-1) ...
Setting up libfile-which-perl (1.09-1) ...
Setting up libfile-homedir-perl (1.00-1) ...
Setting up libfile-sharedir-perl (1.03-1) ...
Setting up libpath-class-perl (0.33-1) ...
Setting up libparams-classify-perl (0.013-4build2) ...
Setting up libmodule-runtime-perl (0.013-1) ...
Setting up libpath-tiny-perl (0.052-1) ...
Setting up librole-tiny-perl (1.003002-1) ...
Setting up libsub-exporter-perl (0.986-1) ...
Setting up libpath-isdev-perl (1.000002-1) ...
Setting up libpath-finddev-perl (0.4.0-1) ...
Setting up libfile-sharedir-projectdistdir-perl (0.5.2-1) ...
Setting up libio-string-perl (1.08-3) ...
Setting up liblingua-en-inflect-perl (1.895-1) ...
Setting up liblist-moreutils-perl (0.33-1build3) ...
Setting up libfile-slurp-perl (9999.19-4) ...
Setting up libpod-spell-perl (1.12-1) ...
Setting up libtask-weaken-perl (1.04-1) ...
Setting up libppi-perl (1.215-1) ...
Setting up libppix-regexp-perl (0.036-1) ...
Setting up libreadonly-perl (1.04-1) ...
Setting up libppix-utilities-perl (1.001000-1) ...
Setting up libreadonly-xs-perl (1.05-1) ...
Setting up libstring-format-perl (1.17-1) ...
Setting up perltidy (20120701-1) ...
Setting up libperl-critic-perl (1.121-1) ...
Setting up libunicode-utf8-perl (0.59-1build1) ...
```

## インストールの確認
コマンド：
perlcritic --version      
(実行結果)
1.121


### 続く
[Perl::Critic(perlcritic)を使用して静的解析、コーディング規約テストを実施(実施編：コマンド)](http://qiita.com/sfida11/items/22e6e768a6b4e65bddae)
[Perl::Critic(perlcritic)を使用して静的解析、コーディング規約テストを実施(実施編：ファイル)](http://qiita.com/sfida11/items/1c2e06d349f169d50c45)