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