Modules I want, but don't want to write

brian_d_foy on 2005-02-15T01:40:46

These module names have been on my white board for a couple of months. I'd use them if they existed, and if I had more time to think about them I might even create them myself, but they don't so I'm not. I'm not keeping them on the board either, so I'll just archive them here and forget about them.

Test::Fathom: A Test::* version of B::Fathom, where you set the score your code has to come in under (or between). Mostly for giggles.

Test::NewVersion: checks that the version of the distribution and modules you are about to upload are later than the ones you've already uploaded.

Business::ISSN: Go from ISSN to periodical name. There's not much to this module because there's really not much to do. The ISSN doesn't really mean anything other than a one-to-one mapping.


Test::Fathom

rjbs on 2005-02-16T00:28:12

Lame, but workable.

Synopsis:
fathom_avg_cmp('Your::Module','>=',0.5,"half legible")

Package:

package Test::Fathom;
use base qw(Exporter); our @EXPORT = qw(fathom_avg_cmp);
use Test::More;
use B::Fathom;
use List::Util qw(sum);

sub import { shift; plan @_ }

sub fathom_avg_cmp {
    my $package = shift;
    $f = B::Fathom->new;

    eval "require $package" or die $@;
    @scores =
        map { $f->score($_) }
        map { *{$package."::$_"}{CODE} || () } keys %{$package."::"};

    my $avg = sum(@scores) / @scores;

    cmp_ok($avg, $_[0], $_[1], $_[2])
}

1;