Opps, missed that. I got too anxious trying out the code. Anyways, I created my own version that includes POD counts. Thanks for your contribution, psychotic.
#!/usr/bin/perl use strict; use warnings; use File::Find; MAIN: { # Top directory to look through my $dir = (@ARGV) ? shift : '.'; # Find Perl files in directory my @files; find sub { my $fname = $_; if (-f $fname) { foreach my $type (qw(pl pm)) { my (undef, $ext) = split (/\./, $fname); if (defined($ext) && $ext eq $type) { push(@files, $File::Find::name); } } } }, $dir; if (! @files) { print("No Perl files found in '$dir'\n"); exit(1); } # Header print(" Code Cmts POD Total File\n"); print("=" x 60, "\n"); # Process files and generate totals my ($tloc, $tcom, $ttot, $tpod) = (0,0,0,0); foreach my $file (@files) { my ($loc, $com, $pod) = (0,0,0); # Slurp file my $contents = do { local (*ARGV, $/) = [$file] and <> }; my @lines = split(/$\//, $contents); # Process lines while (@lines) { my $line = shift(@lines); # Ignore blank lines if ($line =~ /^\s*$/) { next; } # Count POD if ($line =~ /^=[a-z]/) { $pod++; while (@lines) { my $pline = shift(@lines); if ($pline =~ /^\s*$/) { next; # Ignore blank lines } $pod++; if ($pline =~ /^=cut/) { last; # Done with POD block } } } # Comments and code elsif ($line =~ /^\s*\#/) { $com++; } else { $loc++; } } # File results my $tot = $loc + $com + $pod; printf("% 5d % 5d % 5d % 5d %s\n", $loc, $com, $pod, $tot, $fi +le); # Totals $tloc += $loc; $tcom += $com; $tpod += $pod; $ttot += $tot; } # Print grand totals print("=" x 60, "\n"); printf("% 5d % 5d % 5d % 5d %s\n", $tloc, $tcom, $tpod, $ttot, '-- + Summary of all files'); } exit(0); # EOF
UPDATE: Added correction suggested by psychotic.

Remember: There's always one more bug.

In reply to Re^3: Perl project lines of code "analyzer" by jdhedden
in thread Perl project lines of code "analyzer" by psychotic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.