Commit | Line | Data |
a67b1afa |
1 | #!/usr/bin/perl -w |
f7b649f0 |
2 | |
3 | require './test.pl'; |
a67b1afa |
4 | |
5 | use strict; |
6 | |
a67b1afa |
7 | { |
8 | package My::Pod::Checker; |
9 | use strict; |
10 | use parent 'Pod::Checker'; |
11 | |
12 | use vars '@errors'; # a bad, bad hack! |
13 | |
14 | sub poderror { |
15 | my $self = shift; |
16 | my $opts; |
17 | if (ref $_[0]) { |
18 | $opts = shift; |
19 | }; |
20 | ++($self->{_NUM_ERRORS}) |
21 | if(!$opts || ($opts->{-severity} && $opts->{-severity} eq 'ERROR')); |
22 | ++($self->{_NUM_WARNINGS}) |
23 | if(!$opts || ($opts->{-severity} && $opts->{-severity} eq 'WARNING')); |
24 | push @errors, $opts; |
25 | }; |
26 | } |
27 | |
69f6a9a1 |
28 | |
29 | use strict; |
30 | use File::Spec; |
31 | chdir '..'; |
32 | my @files; |
33 | my $manifest = 'MANIFEST'; |
34 | |
35 | open my $m, '<', $manifest or die "Can't open '$manifest': $!"; |
36 | |
37 | while (<$m>) { |
38 | chomp; |
39 | next unless /\s/; # Ignore lines without whitespace (i.e., filename only) |
40 | my ($file, $separator) = /^(\S+)(\s+)/; |
41 | next if $file =~ /^cpan\//; |
42 | next unless ($file =~ /\.(?:pm|pod|pl)$/); |
43 | push @files, $file; |
a67b1afa |
44 | }; |
cc4c9faa |
45 | @files = sort @files; # so we get consistent results |
a67b1afa |
46 | |
47 | sub pod_ok { |
48 | my ($filename) = @_; |
49 | local @My::Pod::Checker::errors; |
50 | my $checker = My::Pod::Checker->new(-quiet => 1); |
51 | $checker->parse_from_file($filename, undef); |
52 | my $error_count = $checker->num_errors(); |
53 | |
f7b649f0 |
54 | if(! ok($error_count <= 0, "POD of $filename")) { |
a67b1afa |
55 | diag( "'$filename' contains POD errors" ); |
f7b649f0 |
56 | diag(sprintf "%s %s: %s at line %s", |
57 | $_->{-severity}, $_->{-file}, $_->{-msg}, $_->{-line}) |
a67b1afa |
58 | for @My::Pod::Checker::errors; |
59 | }; |
60 | }; |
61 | |
f7b649f0 |
62 | plan (tests => scalar @files); |
a67b1afa |
63 | |
64 | pod_ok $_ |
65 | for @files; |
66 | |
67 | __DATA__ |
68 | lib/ |
69 | ext/ |
70 | pod/ |
71 | AUTHORS |
72 | Changes |
73 | INSTALL |
74 | README* |
9dab8649 |
75 | *.pod |