in reply to Perl LOC counter?

I wrote a script like that. It's available here:

http://www.bahnhof.se/~johanl/perl/perl_summary/perl_summary.pl.txt

This is a typical output when $ARGV1 doesn't contain an output file:

*** MODULES ***
Total used: 45

-- SKIP MODULE LIST --


No files: 33

*** LINES ***
Source (total): 12094
    Code + POD: 9101 (75%)
          Code: 6090 (50%)
           POD: 3011 (24%) (33% of code + POD lines)
 Comments left: 183 ( 1%) of source
  Comments EOL: 408 ( 6%) of code
    Whitespace: 6004 (49%)
     Size (Kb): 216

If you provide an output file, you can run it daily and open the file in Execel and create a progress diagram over time.

All available disclaimers apply, it's second time it left my computer today :) If you find it usefull, fine. If not, fine. I'm sure ther are stuff to improve.

/J

Replies are listed 'Best First'.
Re: Re: Perl LOC counter?
by samtregar (Abbot) on May 15, 2003 at 20:35 UTC
    Very interesting. I ran this on some test code and the results are very different from SLOCCount (see above). They're around twice as high for the count of lines of code. My guess is that it has something to do with how you're counting POD lines. SLOCCount just stops counting lines of code when it sees /^=\w/ and starts again when it sees /^=cut/. Your method seems more sophisticated, but I wonder if it's correct. I plan to investigate more closely to figure out which one is right.

    -sam

      Well, looking at my code I see that

      $noLineCode += scalar(grep { $_ =~ /\w/ } @aLine);

      will include POD as well, so... it actually measures "code" as opposed to "whitespace", not "code" as opposed to "non-code". Eh, so to speak :)

      It depends on what you want to measure and what you think the metric says about the source.

      /J