Michael G Schwern wrote:
> Since skip_all will exit immediately you can fold that big "everything
> inside the else block" away.
>
> eval 'use Test::Pod';
> my $have_testpod = !$@ and $Test::Pod::VERSION >= 0.95;
> plan skip_all => "Test::Pod v0.95 required for testing POD"
> unless $have_testpod;
>
> my @files;
> my $blib = File::Spec->catfile(qw(blib lib));
> ...
There is a misprint in this line:
my $have_testpod = !$@ and $Test::Pod::VERSION >= 0.95;
It should read:
my $have_testpod = !$@ && $Test::Pod::VERSION >= 0.95;
Based on the excellent work from Lester & Schwern, I could not restrain
myself from shortening this a little more (since it will be included
in many distributions). My current short version is:
use Test::More;
use File::Spec;
use File::Find;
use strict;
eval 'use Test::Pod';
plan skip_all => "Test::Pod v0.95 required for testing POD"
if $@ || $Test::Pod::VERSION < 0.95;
my @files;
find( sub {push @files, $File::Find::name if /\.p(?:l|m|od)$/},
File::Spec->catfile( qw(blib lib) ) );
plan tests => scalar @files;
foreach my $file (@files) { pod_file_ok($file) }
Two questions:
1) Is using $File::Find::name portable on VMS and Mac OS?
(I'm confused about File::Find's use of 'Unix' names).
2) Which is preferred:
eval 'use Test::Pod';
or:
eval { require Test::Pod };
...
Test::Pod->import;
or does it not matter?
/-\
http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.