COUNTPERL(1)

πŸ“¦
version 1.0.3 Β· 2 versions
, in fedora 43

πŸ’– COUNTPERL πŸ’–

okay bestie, so this is countperl from the User Contributed Perl Documentation crew β€” a whole little tool that counts your lines, your packages, your subs and your complexity in Perl files. it's giving metrics era and honestly? we're obsessed. ✨


🌸 NAME 🌸

countperl β€” 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 🫢

you gotta give it at least one file or directory path. like, at minimum. it's not gonna read your mind, bestie. πŸ’…


πŸ’… OPTIONS πŸ’…

  • --help β€” prints the documentation to STDERR. (not stdout, okay, it's quirky like that πŸŽ€)
  • --html β€” spits out HTML instead of the plain-text default. glow up your report ✨
  • --json β€” spits out JSON instead of the plain-text default. for the girlies who pipeline πŸ¦‹
  • --method-modifiers=a,b,c β€” a comma-separated list of method modifiers to be recognised. peep Moose::Manual::MethodModifiers for the deets. if you don't specify, the default list is before,after,around. no cap. πŸ‘‘

πŸ”§ CONFIGURATION πŸ”§

N/A. currently no support for any configuration files. it's lowkey a minimalist, and honestly? respect. πŸ’€


🌈 EXIT STATUS 🌈

exits zero on success, non-zero on failure. classic. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

countperl uses Perl::Metrics::Simple to examine the named files and recursivesly search 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 it has what appears to be a perl shebang line β€” congrats, it's in. πŸŽ‰

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.) like it's literally doing the most and we love that for it. πŸ’–

πŸ“Š Output Format πŸ“Š

line counts do not include comments nor pod. (sorry pod girlies, you're not counted here πŸ™ˆ)

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 the --html switch, output format is HTML. πŸ’…


⭐ VERSION ⭐

this is version 0.031 of countperl. she's a specific era, okay? πŸŽ€


🩺 DIAGNOSTICS 🩺

prints a usage message to STDERR if required arguments are not provided. basically it will politely (?) tell you that you forgot the files. 😭


πŸ™… INCOMPATIBILITIES πŸ™…

None known. she plays nice. 🌸


πŸ’€ 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 piping your vibes in, sorry πŸ₯²)
  • 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 πŸ‘€


πŸ‘‘ AUTHOR πŸ‘‘

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

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.


and that's the whole page, bestie πŸ’– this was countperl from perl v5.42.0, dated 2025-07-25 β€” go forth and count your little subs, you absolute main character. πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from