Tuesday, October 03, 2006


Counts files, packages, subroutines, and calculates cyclomatic complexity of Perl files.

I recently released an alpha version of new Perl module: Perl::Metrics::Simple

There is an included script, in the examples/ directory which produces output like this:

Perl Files: $file_count

Line Counts
lines: $lines
packages: $package_count
subs: $sub_count
all main code: $main_stats->{lines}

min. sub size: $lines{min} lines
max. sub size: $lines{max} lines
avg. sub size: $lines{average} lines
median sub size: $lines{median}

McCabe Complexity
min. main: $main_complexity{min}
max. main: $main_complexity{max}
median main: $main_complexity{median}
average main: $main_complexity{average}

min: $complexity{min}
max: $complexity{max}
avg: $complexity{average}
median: $complexity{median}
std. deviation: $complexity{standard_deviation}