countperl(1p)

countperl1p

Count lines, packages, subs, and complexity of perl files.

Usage

countperl FILE_OR_DIRECTORY [FILE_OR_DIRECTORY ...] [--html] [--help] [--method-modifiers=a,b,c]

Required arguments

At least one file or directory path must be supplied.

Options

--help

Prints documentation to STDERR.

--html

Produces HTML output instead of the plain-text default.

--json

Produces JSON output instead of the plain-text default.

--method-modifiers=a,b,c

A comma-separated list of method modifiers to be recognised, see Moose::Manual::MethodModifiers for details. If unspecified, the default list is before,after,around.

Configuration

N/A. Currently no support for any configuration files.

Exit status

Exits zero on success, non-zero on failure.

Overview

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

With --html switch output format is HTML.

Version

This is version 0.031 of countperl.

Diagnostics

Prints usage message to STDERR if required arguments are not provided.

Incompatibilities

None known.

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

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 5 times.

  1. 6.0–7
  2. 8
  3. 9–10
  4. 11
  5. 12
  6. 13

--help since Debian 8 (Jessie); --html since Debian 8 (Jessie); --json since Debian 11 (Bullseye); --method-modifiers since Debian 9 (Stretch).

Author

    Matisse Enzer
    CPAN ID: MATISSE
    Eigenstate Consulting, LLC
    [email protected]
    http://www.eigenstate.net/

From libperl-metrics-simple-perl 1.0.3-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.