CPAN Purity tester

Here's a fairly sweet perl hack that I just wrote. Test how much of a the guts of a program comes from sweet, delicious CPAN, and how much is nasty perl code you wrote.

joey@dragon:~> cpan-purity cpan-purity        
usage: cpan-purity [--verbose] [--mine=regexp] -- program args
** CPAN Prurity test results: 98.08% pure CPAN code.
** 7107 lines in 24 files were from CPAN, and 139 lines in 1 files werenot.

joey@dragon:~> cpan-purity -- perl -e 'use Coy; die "whups, gotta go.."'

        -----
        Two rabbits walk. A 
        pair of lovers beside a pool. 
        A trout in the dam.
        -----

                Homer Simpson's commentary...

                whups, gotta go.. 

                        (Sayings of -e: line 1.)
** Looks like that was a perl one-liner..
** CPAN Prurity test results: 99.98% pure CPAN code.
** 6028 lines in 16 files were from CPAN, and 1 lines in 0 files were not.

joey@dragon:~> cpan-purity --mine=debconf dpkg-preconfigure
dpkg-preconfigure: must specify some debs to preconfigure
** CPAN Prurity test results: 70.49% pure CPAN code.
** 6745 lines in 41 files were from CPAN, and 2823 lines in 20 files were not.

joey@dragon:~> cpan-purity ikiwiki
Forcing /home/joey/src/ikiwiki/ikiwiki to run without taint checking..
usage: ikiwiki [options] source templates dest
** CPAN Prurity test results: 91.59% pure CPAN code.
** 12273 lines in 27 files were from CPAN, and 1126 lines in 1 files were not.

After all, writing more perl code is bad, but CPAN rules, right? So they tell me.

That was a lot of fun to figure out how to write, pity it's too special purpose for moreutils. :-)

Oh and by the way, the extra 600 lines shown in ikiwiki, up from the 300 lines it was two days ago include nearly everything you'd expect in a modern wiki, from templating to user login and registration, etc. It's nearing 0.1 state.