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 ]

petdance (2468)

petdance
  andy@petdance.com
http://www.perlbuzz.com/
AOL IM: petdance (Add Buddy, Send Message)
Yahoo! ID: petdance (Add User, Send Message)
Jabber: petdance@gmail.com

I'm Andy Lester, and I like to test stuff. I also write for the Perl Journal, and do tech edits on books. Sometimes I write code, too.

Journal of petdance (2468)

Wednesday January 29, 2003
11:33 PM

Improved POD testing with Pod::Simple

[ #10288 ]
I just overhauled the stock t/99.pod.t that brian handed me once:

use Test::More;

use File::Spec;
use File::Find;
use strict;

eval {
    require Pod::Simple;
};

my @files;
if ($@) {
    plan skip_all => "Pod::Simple required for testing POD";
} else {
    my $blib = File::Spec->catfile(qw(blib lib));
    find(\&wanted, $blib);
    plan tests => scalar @files;

    foreach my $file (@files) {
        my $checker = Pod::Simple->new;

        $checker->output_string( \my $trash ); # Ignore any output
        $checker->parse_file( $file );
        unless ( ok( !$checker->any_errata_seen, $file ) ) {
            my $lines = $checker->{errata};
            for my $line ( sort { $a<=>$b } keys %$lines ) {
                my $errors = $lines->{$line};
                diag( "$file ($line): $_" ) for @$errors;
            }
        }
    }
}

sub wanted {
    push @files, $File::Find::name if /\.p(l|m|od)$/ || /\.t$/;
}

Sean's Pod::Simple makes things so much nicer than Pod::Checker for stuff like this. I'm going to have to overhaul Test::Pod to use it, since brian's going away and someone has to keep his modules warm.

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.