Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

countperl(1p) [debian man page]

COUNTPERL(1p)						User Contributed Perl Documentation					     COUNTPERL(1p)

NAME
countperl - count lines, packages, subs and complexity of Perl files. SYNOPSIS
countperl FILE_OR_DIRECTORY [FILE_OR_DIRECTORY ....] REQUIRED ARGUMENTS
At least one file or directory path must be supplied. EXIT STATUS
Exits zero on success, non-zero on failure. DESCRIPTION
countperl uses Perl::Metrics::Simple to examines the named files and recursivesly searches named directories for Perl files. Perl files are identified by Perl::Metrics::Simple->is_perl_file. Basically if the file ends in ".pl", ".pm", or ".t" or has what appears to be a perl shebang line. countperl produces a report on STDOUT of counts of total lines, packages, subroutines/methods, the minimum, maximum, mean, standard deviation, and median size and mccabe_complexity (cyclomatic complexity) of subroutines and the 'main' portion of each file (everything not in a subroutine.) Output Format Line counts do not include comments nor pod. The current output format is human-readable text: Perl files found: 3 Counts ------ total code lines: 856 lines of non-sub code: 450 packages found: 3 subs/methods: 42 Subroutine/Method Size ---------------------- min: 3 lines max: 32 lines mean: 9.67 lines std. deviation: 7.03 median: 7.50 McCabe Complexity ----------------- Code not in any subroutine:: min: 1 max 1 mean: 1.00 std. deviation: 0.00 median: 1.00 Subroutines/Methods: min: 1 max: 5 avg: 1.00 std. deviation: 1.36 median: 1.00 Tab-delimited list of subroutines, with most complex at top ----------------------------------------------------------- complexity sub path size 5 is_perl_file lib/Perl/Metrics/Simple.pm 11 5 _has_perl_shebang lib/Perl/Metrics/Simple.pm 13 5 _init lib/Perl/Metrics/Simple/Analysis/File.pm 30 4 find_files lib/Perl/Metrics/Simple.pm 11 4 new lib/Perl/Metrics/Simple/Analysis.pm 10 4 is_ref lib/Perl/Metrics/Simple/Analysis.pm 8 VERSION
This is version 0.031 of countperl. BUGS AND LIMITATIONS
Bugs No bugs reported yet :-) See: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Metrics-Simple Limitations Does not accept input from STDIN. No machine-readable report format available (e.g. XML, tab-delimited) 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 DEPENDENCIES
Perl::Metrics::Simple 0.13 (which depends upon PPI.) Pod::Usage SEE ALSO
PPI Perl::Critic Perl::Metrics http://en.wikipedia.org/wiki/Cyclomatic_complexity 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. perl v5.10.1 2010-05-13 COUNTPERL(1p)

Check Out this Related Man Page

Perl::Metrics::Simple::Analysis(3pm)			User Contributed Perl Documentation		      Perl::Metrics::Simple::Analysis(3pm)

NAME
Perl::Metrics::Simple::Analysis - Contains anaylsis results. SYNOPSIS
This is the class of objects returned by the analyze_files method of the Perl::Metrics::Simple class. Normally you would not create objects of this class directly, instead you get them by calling the analyze_files method on a Perl::Metrics::Simple object. VERSION
This is VERSION 0.1 DESCRIPTION
USAGE
new $analysis = Perl::Metrics::Simple::Analsys->new( @file_objects ) Takes an arrayref of Perl::Metrics::Simple::Analysis::File objects and returns a new Perl::Metrics::Simple::Analysis object. data The raw data for the analysis. This is the arrayref you passed as the argument to new(); files Arrayref of file paths, in the order they were encountered. file_count How many Perl files were found. lines Total lines in all files, excluding comments and pod. main_stats Returns a hashref of data based the main code in all files, that is, on the code minus all named subroutines. { lines => 723, mccabe_complexity => 45 } file_stats Returns an arrayref of hashrefs, each entry is for one analyzed file, in the order they were encountered. The main_stats slot in the hashref is for all the code in the file outside of any named subroutines. [ { path => '/path/to/file', main_stats => { lines => 23, mccabe_complexity => 3, path => '/path/to/file', name => '{code not in named subroutines}', }, }, ... ] packages Arrayref of unique packages found in code. package_count How many unique packages found. subs Array ref containing hashrefs of all named subroutines, in the order encounted. Each hashref has the structure: { 'lines' => 19, 'mccabe_complexity' => 6, 'name' => 'databaseRecords', 'path' => '../path/to/File.pm', } sub_count How many subroutines found. summary_stats Returns a data structure of the summary counts for all the files examined: { sub_length => { min => $min_sub_length, max => $max_sub_length, sorted_values => @lengths_of_all_subs, mean => $average_sub_length, median => $median_sub_length, standard_deviation => $std_dev_for_sub_lengths, }, sub_complexity => { min => $min_sub_complexity, max => $max_sub_complexity, sorted_values => @complexities_of_all_subs, mean => $average_sub_complexity, median => $median_sub_complexity, standard_deviation => $std_dev_for_sub_complexity, }, main_complexity => { min => $min_main_complexity, max => $max_main_complexity, sorted_values => @complexities_of_all_subs, mean => $average_main_complexity, median => $median_main_complexity, standard_deviation => $std_dev_for_main_complexity, }, } STATIC PACKAGE SUBROUTINES
Utility subs used internally, but no harm in exposing them for now. Call these with a fully-qualified package name, e.g. Perl::Metrics::Simple::Analysis::is_ref($thing,'ARRAY') is_ref Takes a thing and a type. Returns true is thing is a reference of type type, otherwise returns false. BUGS AND LIMITATIONS
None reported yet ;-) DEPENDENCIES
Readonly Statistics::Basic 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
Copyright (c) 2006-2009 by Eigenstate Consulting, LLC. 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
perl(1). perl v5.10.1 2010-05-13 Perl::Metrics::Simple::Analysis(3pm)
Man Page