How to determine coupling and cohesion of a perl program?

Martin Cleaver mrjcleaver at
Wed Jul 10 23:59:37 CDT 2002

Hi all,
   It was good to meet you all last night. As promised, here is
my perl problem

   When I studied software engineering, much was made of how
low-coupling and high-coherence would ensure the maintainability
of a piece of code. 

I've been looking around, to no avail, for a something to analyse
Perl scripts for these qualities. I want to use them as the basis
for suggesting improvements to the authors of those scripts and

Indeed, a search on SF got me only which is
supposed to analyse Java when they get around to releasing some
code, and CCCC (
which has a vitality rating of 0.02% (Rank 3344)

I also found Module::Dependency on CPAN but, although this does
give some indication of dependency, doesn't give metrics on how
well the code is written and uses a fairly crude albeit effective
method of searching for 'require' and 'use' strings to create its

I figure that to fully work out the coupling between modules, the
degree to which global variables are shared must be taken into
account, Module::Dependency can't do this.

I also figure that pretty much the only thing I have seen that
would track dependencies to this degree would be the pre-compile
classes, B.

Adrian Masters mentioned the right place to start might be a Perl
Parser, well I found a Pod::Parser
so that might help. He also mentioned the profilers such as
Devel::Cover,Devel::Coverage and Devel::DProf, Devel::SmallProf.

Because laziness and hubris encourages us to not reinvent the
wheel I'd much rather use (or improve on) someone else's work
than start coding myself.

Can anyone further my research on this?

Thanks guys,
Regards,   M.


Martin.Cleaver at (please don't reply to @yahoo)

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

More information about the Melbourne-pm mailing list