On Tue, Feb 14, 2006 at 11:52:55PM -1000, Joshua Hoblitt wrote:
> On Tue, Feb 14, 2006 at 05:23:39PM -0800, Will Coleda wrote:
> > 2) checks every file with pod in that directory hierarchy.
> > 
> > It should only check those files that are in MANIFEST. (And  
> > *possibly* MANIFEST.generated)
> 
> It's trivial to parse those files but is there a pre-existing parser
> module I don't know about?  There's no point in getting locked into the
> current format if we don't have to.

It turns out there is a 'maniread()' function in ExtUtils::Manifest that
I'd overlooked.

Attached is a patch to t/doc/pod.t that changes it to only test files in
MANIFEST & MANIFEST.generated.  It also induces a change in what's
considered a 'Pod' file.  Currently only files named 'foo.pod',
'foo.pl', 'foo.pm' are being tested for containing pod.  This patch
tests all files in MANIFEST, including '.c' files, to see if they
contain pod.  I'd like to get some feedback about this change before
committing the patch.

Cheers,

-J

--
=== t/doc/pod.t
==================================================================
--- t/doc/pod.t (revision 11560)
+++ t/doc/pod.t (local)
@@ -5,8 +5,9 @@
 use strict;
 use warnings;
 use lib qw( . lib ../lib ../../lib );
-use vars qw( %docs $n_docs );
+use vars qw(@docs);
 use Parrot::Config;
+use ExtUtils::Manifest qw(maniread);
 
 BEGIN {
     eval "use Pod::Find";
@@ -14,18 +15,23 @@
         print "1..1\nok 1 # skip Pod::Find not installed\n";
         exit;
     }
+
     # XXX this should really be using src_dir insetad of build_dir but it
     # doesn't exist (yet)
-    %docs = Pod::Find::pod_find(
-        { -verbose => 0, -inc => 0 },
-        $PConfig{build_dir} # search path(s)
-    );
+    my $build_dir = $PConfig{build_dir};
+    my $manifest     = maniread("$build_dir/MANIFEST");
+    my $manifest_gen = maniread("$build_dir/MANIFEST.generated");
 
-    $n_docs = scalar keys %docs;
+    foreach my $file (keys(%$manifest), keys(%$manifest_gen)) {
+        $file = "$build_dir/$file";
+        # skip missing MANIFEST.generated files
+        next unless -e $file;
+        push @docs, $file if Pod::Find::contains_pod($file, 0);
+    }
 }
 
 
-use Test::More tests => $n_docs;
+use Test::More tests => scalar @docs;
 
 
 =head1 NAME
@@ -45,6 +51,6 @@
 
 eval "use Test::Pod 0.95";
 SKIP: {
-    skip "Test::Pod 0.95 not installed.", $n_docs if $@;
-    Test::Pod::pod_file_ok( $_ ) foreach keys %docs;
+    skip "Test::Pod 0.95 not installed.", scalar @docs if $@;
+    Test::Pod::pod_file_ok( $_ ) foreach @docs;
 }

Attachment: pgprJD8ONG4va.pgp
Description: PGP signature

Reply via email to