1Perl::Metrics::Simple(3U)ser Contributed Perl DocumentatiPoenrl::Metrics::Simple(3)
2
3
4

NAME

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

SYNOPSIS

10         use Perl::Metrics::Simple;
11         my $analyzer = Perl::Metrics::Simple->new;
12         my $analysis = $analyzer->analyze_files(@paths, @refs_to_file_contents);
13         $file_count    = $analysis->file_count;
14         $package_count = $analysis->package_count;
15         $sub_count     = $analysis->sub_count;
16         $lines         = $analysis->lines;
17         $main_stats    = $analysis->main_stats;
18         $file_stats    = $analysis->file_stats;
19

DESCRIPTION

21       Perl::Metrics::Simple provides just enough methods to run static
22       analysis of one or many Perl files and obtain a few metrics: packages,
23       subroutines, lines of code, and an approximation of cyclomatic (mccabe)
24       complexity for the subroutines and the "main" portion of the code.
25
26       Perl::Metrics::Simple is far simpler than Perl::Metrics.
27
28       Installs a script called countperl.
29

USAGE

31       See the countperl script (included with this distribution) for a simple
32       example of usage.
33

CLASS METHODS

35   new
36       Takes no arguments and returns a new Perl::Metrics::Simple object.
37
38   is_perl_file
39       Takes a path and returns true if the target is a Perl file.
40

OBJECT METHODS

42   analyze_files( @paths, @refs_to_file_contents )
43       Takes an array of files and or directory paths, and/or SCALAR refs to
44       file contents and returns an Perl::Metrics::Simple::Analysis object.
45
46   find_files( @directories_and_files )
47       Uses list_perl_files to find all the readable Perl files and returns a
48       reference to a (possibly empty) list of paths.
49
50   list_perl_files
51       Takes a list of one or more paths and returns an alphabetically sorted
52       list of only the perl files.  Uses is_perl_file so may throw an
53       exception if a file is unreadable.
54
55   is_perl_file($path)
56       Takes a path to a file and returns true if the file appears to be a
57       Perl file, otherwise returns false.
58
59       If the file name does not match any of
60       @Perl::Metrics::Simple::PERL_FILE_SUFFIXES then the file is opened for
61       reading and the first line examined for a a Perl 'shebang' line. An
62       exception is thrown if the file cannot be opened in this case.
63
64   should_be_skipped($path)
65       Returns true if the path should be skipped when looking for Perl files.
66       Currently skips  .svn, CVS, and _darcs directories.
67

BUGS AND LIMITATIONS

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

SUPPORT

72       Via CPAN:
73
74   Disussion Forum
75       http://www.cpanforum.com/dist/Perl-Metrics-Simple
76
77   Bug Reports
78       http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Metrics-Simple
79

AUTHOR

81           Matisse Enzer
82           CPAN ID: MATISSE
83           Eigenstate Consulting, LLC
84           matisse@eigenstate.net
85           http://www.eigenstate.net/
86
88       Copyright (c) 2006-2009 by Eigenstate Consulting, LLC.
89
90       This program is free software; you can redistribute it and/or modify it
91       under the same terms as Perl itself.
92
93       The full text of the license can be found in the LICENSE file included
94       with this module.
95

SEE ALSO

97       The countperl script included with this distribution.
98       PPI
99       Perl::Critic
100       Perl::Metrics
101       http://en.wikipedia.org/wiki/Cyclomatic_complexity
102
103
104
105perl v5.34.0                      2021-07-22          Perl::Metrics::Simple(3)
Impressum