perlsloc - Count Perl Source Lines with Perl::Tidy

Tags:

Originally posted as: perlsloc - Count Perl Source Lines with Perl::Tidy on blogs.perl.org.

While spending some time putting together my own perltidyrc file, I became intimately familiar with the Perl::Tidy documentation.

One day, I decided to find out exactly how much code I was maintaining. Since perltidy can strip comments and POD, and also normalize the source code to make a fair measurement, it's a perfect tool for counting Source Lines of Code (SLOC).

Here's a small shell script using ack, perltidy, xargs, and wc to count the source lines of code in any number of directories.

ack -f --perl $@ | xargs -L 1 perltidy --noprofile --delete-pod --mbl=0 --standard-output | wc -l

ack -f lists the files that would be searched, and --perl searches Perl files, so we get ack's heuristics for finding Perl files. xargs -L 1 invokes the following command for every 1 line of input. The perltidy command strips the pod and tightens up the whitespace and writes the result to stdout, which wc -l will then count, line by line.

So, as an example, the current Statocles release has 50% more test lines than source lines:

» perlsloc lib bin
    1034
» perlsloc t
    1633

Conflict Resolution: local::lib and git's Perl

Tags:

Originally posted as: Conflict Resolution: local::lib and git's Perl on blogs.perl.org.

I ran into a frustrating problem the other day:

$ git add -i
/usr/bin/perl: symbol lookup error: ~/perl5/lib/perl5/x86_64-linux-thread-multi/auto/List/Util/Util.so:
undefined symbol: Perl_xs_apiversion_bootcheck
fatal: 'add--interactive' appears to be a git command, but we were not
able to execute it. Maybe git-add--interactive is broken?

Continue reading Conflict Resolution: local::lib and git's Perl...

Chicago.PM New Website! New Meetup URL! New Presentations Project!

Tags:

Originally posted as: Chicago.PM New Website! New Meetup URL! New Presentations Project! on blogs.perl.org.

Lots of news for the Chicago.PM group! We've got a new Chicago.PM website, powered by Github, up at http://chicago.pm.org. The website is completely editable via Github using the Octopress system. We hope to start sharing resources about Perl on our website, increasing the exposure of the good tutorials and learning sites.

Continue reading Chicago.PM New Website! New Meetup URL! New Presentations Project!...