Perl Metrics

Introduction
I am now an independent Linux consultant and owner of Built On Linux. When I was doing engineering management at Brightmail , we had a lot of Perl code in-house and I wanted to get a grip on its quality. I wrote this as a quick hack to improve said quality by measuring some of the more obvious features of the code. This is my first pass at measuring some of the things that make software readable and maintainable.

Description
This program is intended to help perl programmers write better code by becoming more aware of their coding style. In particular, one would like to know the code-to-comment ratio, the average number of lines per subroutine, the longest subroutine, and things like that.

News

Sample Output

===> perl-metrics.pl <===

code_with_comment                 2
subroutine_lines                115
blank_lines                      52
subroutines                       6
comment_lines                    37
pure_code                       106
total_lines                     197
DANGER -->  82 non-subroutine lines
code-to-comment ratio           2.7
avg lines per subroutine       16.7
longest subroutine: count_things (53 lines)

Download

Share and enjoy!

ChangeLog

perl_metrics-0.04.tar.gz
perl_metrics-0.03.tar.gz
perl_metrics-0.02.tar.gz
perl_metrics-0.01.tar.gz


Last Modified: Fri Oct 15 13:25:57 CDT 2004

Please write me with your feedback, patches, etc.
eisen@dunhackin.org
http://www.dunhackin.org/~eisen