Now in a CPAN near you:  Perl::Metrics::Simple 0.30

Installs the countperl script which you point at one or more Perl files (and/or directories) and get a report of all the subroutines, sorted by complexity.

Line counts exclude both comments and pod.


For example:


% countperl lib/TAPx/

Perl files found:                12

Counts
------
total code lines:        1959
lines of non-sub code:   1261
packages found:          14
subs/methods:            98

Subroutine/Method Size
----------------------
min:                  1 lines
max:                  48 lines
mean:                 7.12 lines
std. deviation:       8.24
median:               4.00

McCabe Complexity
-----------------
Code not in any subroutine::
min:                  1
max                   10
mean:                 1.00
std. deviation:       2.54
median:               1.00

Subroutines/Methods:
min:                  1
max:                  15
avg:                  1.00
std. deviation:       2.60
median:               1.00

Tab-delimited list of subroutines, with most complex at top
-----------------------------------------------------------
complexity      sub     path    size
15      _initialize     lib/TAPx/Parser.pm      48
11      _finish lib/TAPx/Parser.pm      30
11      _switches       lib/TAPx/Parser/Source/Perl.pm  22
10      _aggregate_results      lib/TAPx/Parser.pm      11
10      {code not in named subroutines} lib/TAPx/Parser.pm      626
9       next    lib/TAPx/Parser/Iterator.pm     27
8       _filtered_inc   lib/TAPx/Parser/Source/Perl.pm  15
7       BEGIN   lib/TAPx/Parser.pm      39
6       next    lib/TAPx/Parser.pm      22
6       run     lib/TAPx/Parser.pm      15
6       _lex    lib/TAPx/Parser.pm      18
6       switches        lib/TAPx/Parser/Source/Perl.pm  16
5       BEGIN   lib/TAPx/Parser/Aggregator.pm   22
5       _make_plan_token        lib/TAPx/Parser/Grammar.pm      17
4       _tokens lib/TAPx/Parser.pm      15
4       _check_ending_plan      lib/TAPx/Parser.pm      11
4       _initialize     lib/TAPx/Parser/Aggregator.pm   11
4       add     lib/TAPx/Parser/Aggregator.pm   15
4       _get_parsers    lib/TAPx/Parser/Aggregator.pm   10
4       new     lib/TAPx/Parser/Iterator.pm     14
4       as_string       lib/TAPx/Parser/Results/Test.pm 15
4 {code not in named subroutines} lib/TAPx/Parser/ Grammar.pm 132
3       _validate       lib/TAPx/Parser.pm      10
3 Test::Builder::failure_output lib/TAPx/Parser/ Builder.pm 8
3       filename        lib/TAPx/Parser/Source/Perl.pm  10
3       get_stream      lib/TAPx/Parser/Source/Perl.pm  13
3       _get_command    lib/TAPx/Parser/Source/Perl.pm  9
3       _get_perl       lib/TAPx/Parser/Source/Perl.pm  6
3 {code not in named subroutines} lib/TAPx/Parser/ Iterator.pm 45
2       good_plan       lib/TAPx/Parser.pm      4
2       parsers lib/TAPx/Parser/Aggregator.pm   7
2       _trim   lib/TAPx/Parser/Grammar.pm      6
2       exit    lib/TAPx/Parser/Iterator.pm     1


#---output truncated for space---

Reply via email to