NAME

Perl::Metrics::Simple - Count packages, subs, lines, etc. of many files.

SYNOPSIS

use Perl::Metrics::Simple;
my $analzyer = Perl::Metrics::Simple->new;
my $analysis = $analzyer->analyze_files(@ARGV);
$file_count    = $analysis->file_count;
$package_count = $analysis->package_count;
$sub_count     = $analysis->sub_count;
$lines         = $analysis->lines;
$main_stats    = $analysis->main_stats;
$file_stats    = $analysis->file_stats;

VERSION

This is VERSION 0.02.

DESCRIPTION

Perl::Metrics::Simple is far simpler that Perl::Metrics.

Perl::Metrics::Simple provides just enough methods to run static analysis of one or many Perl files and obtain a few metrics: packages, subroutines, lines of code, and cyclomatic (mccabe) complexity of the subroutines and the "main" portion of the code.

Installs a a script called countperl.

USAGE

TODO: Fill in.

CLASS METHODS

new

Blah blah

is_perl_file

Takes a path and returns true if the target is a Perl file.

OBJECT METHODS

analyze_files( @files_and_or_dirs )

Takes an array of files and or directory paths and returns a Perl::Metrics::Simple::Analysis object.

analyze_one_file

find_files

get_node_length

list_perl_files

measure_complexity($PPI_node)

Attempts to measure the cyclomatic complexity of a chunk of code.

Takes a PPI::Node and returns the total number of logic keywords and logic operators. plus 1. See the PACKAGE PROPERTIES section for a list.

See also: http://en.wikipedia.org/wiki/Cyclomatic_complexity

The code for this method was copied from Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity

is_perl_file($path)

Takes a path to a file and returns true if the file appears to be a Perl file, otherwise returns false.

If the file name does not match any of @Perl::Metrics::Simple::PERL_FILE_SUFFIXES then the file is opened for reading and the first line examined for a a Perl 'shebang' line. An exception is thrown if the file cannot be opened in this case.

BUGS AND LIMITATIONS

None reported yet :-) See: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Metrics-Simple

SUPPORT

Via CPAN:

Disussion Forum

http://www.cpanforum.com/dist/Perl-Metrics-Simple

Bug Reports

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Metrics-Simple

AUTHOR

Matisse Enzer
CPAN ID: MATISSE
Eigenstate Consulting, LLC
matisse@eigenstate.net
http://www.eigenstate.net/

LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

PPI
Perl::Critic
Perl::Metrics
http://en.wikipedia.org/wiki/Cyclomatic_complexity