メトリクスの取得


 Perl::Metrics::Simpleモジュールについてくるcountperlコマンドを使うとメトリクス(行数、複雑度)を簡単に求めることができます。
# コマンド実行例(引数で指定したディレクトリ配下のファイルが対象になります)
>countperl TagCloud
# 結果例
Perl files found:                6

Counts
------
total code lines:        186
lines of non-sub code:   52
packages found:          5
subs/methods:            8

Subroutine/Method Size
----------------------
min:                  3 lines
max:                  48 lines
mean:                 16.75 lines
std. deviation:       15.84
median:               7.50

McCabe Complexity
-----------------
Code not in any subroutine::
min:                  1
max                   3
mean:                 1.33
std. deviation:       0.75
median:               1.00

Subroutines/Methods:
min:                  1
max:                  11
mean:                 4.00
std. deviation:       3.97
median:               1.00

Tab-delimited list of subroutines, with most complex at top
-----------------------------------------------------------
complexity      sub     path    size
11      make    TagCloud/Tagcloud.pm    48
8       get_tags        TagCloud/Make.pm        25
8       get_parse_result        TagCloud/Yahoo.pm       34
3       {code not in named subroutines} TagCloud/test_yahoo.pl  13
1       setup   TagCloud/Tagcloud.pm    9
1       teardown        TagCloud/Tagcloud.pm    3
1       new     TagCloud/Yahoo.pm       6
1       set_error_message       TagCloud/Yahoo.pm       5
1       get_error_message       TagCloud/Yahoo.pm       4
1       {code not in named subroutines} TagCloud/AppDef.pm      4
1       {code not in named subroutines} TagCloud/AppEnv.pm      5
1       {code not in named subroutines} TagCloud/Make.pm        9
1       {code not in named subroutines} TagCloud/Tagcloud.pm    12
1       {code not in named subroutines} TagCloud/Yahoo.pm       9

関連項目

ベンチマーク
プロファイラ