Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Sunday November 06, 2005
03:56 PM

Test::Pod::Coverage and "aliased"

[ #27489 ]

Test::Pod::Coverage is a great module. I use it a lot. Unfortunately, I am constantly getting bit by this module not recognizing "aliased" constant subroutines as something it should ignore.

As an example of the latter, internally my Model::World module does things like this:

use aliased 'Model::World::Word::Adjective';
use aliased 'Model::World::Word::Noun';
use aliased 'Model::World::Thing';
use aliased 'Model::World::Thing::Room';

my $big_room = Room->new( {
    adjective => Adjective->new('big'),
    size      => 10_000
});

my $box = Thing->new( {
    name     => Noun->new('box'),
    location => $big_room,
    size     => ...

aliased does a great job of cutting down on typing, but Test::Pod::Coverage sees those and chokes. Right now I get around that with something like this:

my $aliased = qr/^[[:upper:]][[:alpha:]]*$/;
my @modules =  Test::Pod::Coverage::all_modules();
plan tests => scalar @modules;

foreach my $module (@modules) {
    pod_coverage_ok( $module, { trustme => [ $aliased ] } );
}

There's a risk of false positives, but since I don't ordinarily write subroutines which begin with upper case letters, I think I'm pretty safe.

Of course, I don't really force the programmer to write out all of those "aliased" statements. All the programmer really needs to do is this:

use Model::World ':all';

my $big_room = Room->new( {
    adjective => Adjective->new('big'),
    size      => 10_000
    ...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.