http://qs321.pair.com?node_id=76011


in reply to Line-counts of perl programs/modules

This sounds flippant, but I count lines with wc -l file. My coding style tends to rely heavily on complex data structures. For instance, I'm looking at one of my scripts that declares a hash of hashes that takes up 28 lines (and 110 chars wide). However by counting semis, that counts as only one line.

It does, however pack an awful lot of functionality away: scalars and coderefs. The code that operates upon it is then pretty simple: it just walks down the keys and tells the values to "do themselves".

What about here documents? What about TR's fed map{}ed arrays in CGI.pm? A line can represent a fearsome amount of code in Perl.

So all in all I just run wc and then get on with the job. If it were enough of an obsession and I was a student with a lot of time on my hands I'd consider writing a module to perform function point analysis.


--
g r i n d e r
  • Comment on Re: Line-counts of perl programs/modules