Perl Metrics

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.

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.


Sample Output

===> <===

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)


Share and enjoy!



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

Please write me with your feedback, patches, etc.