1Pod(3) User Contributed Perl Documentation Pod(3)
2
3
4
6 Test::Pod - check for POD errors in files
7
9 Version 1.26
10
12 "Test::Pod" lets you check the validity of a POD file, and report its
13 results in standard "Test::Simple" fashion.
14
15 use Test::Pod tests => $num_tests;
16 pod_file_ok( $file, "Valid POD file" );
17
18 Module authors can include the following in a t/pod.t file and have
19 "Test::Pod" automatically find and check all POD files in a module dis‐
20 tribution:
21
22 use Test::More;
23 eval "use Test::Pod 1.00";
24 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
25 all_pod_files_ok();
26
27 You can also specify a list of files to check, using the
28 "all_pod_files()" function supplied:
29
30 use strict;
31 use Test::More;
32 eval "use Test::Pod 1.00";
33 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
34 my @poddirs = qw( blib script );
35 all_pod_files_ok( all_pod_files( @poddirs ) );
36
37 Or even (if you're running under Apache::Test):
38
39 use strict;
40 use Test::More;
41 eval "use Test::Pod 1.00";
42 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
43
44 my @poddirs = qw( blib script );
45 use File::Spec::Functions qw( catdir updir );
46 all_pod_files_ok(
47 all_pod_files( map { catdir updir, $_ } @poddirs )
48 );
49
51 Check POD files for errors or warnings in a test file, using "Pod::Sim‐
52 ple" to do the heavy lifting.
53
55 pod_file_ok( FILENAME[, TESTNAME ] )
56
57 "pod_file_ok()" will okay the test if the POD parses correctly. Cer‐
58 tain conditions are not reported yet, such as a file with no pod in it
59 at all.
60
61 When it fails, "pod_file_ok()" will show any pod checking errors as
62 diagnostics.
63
64 The optional second argument TESTNAME is the name of the test. If it
65 is omitted, "pod_file_ok()" chooses a default test name "POD test for
66 FILENAME".
67
68 all_pod_files_ok( [@files/@directories] )
69
70 Checks all the files in @files for valid POD. It runs all_pod_files()
71 on each file/directory, and calls the "plan()" function for you (one
72 test for each function), so you can't have already called "plan".
73
74 If @files is empty or not passed, the function finds all POD files in
75 the blib directory if it exists, or the lib directory if not. A POD
76 file is one that ends with .pod, .pl and .pm, or any file where the
77 first line looks like a shebang line.
78
79 If you're testing a module, just make a t/pod.t:
80
81 use Test::More;
82 eval "use Test::Pod 1.00";
83 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
84 all_pod_files_ok();
85
86 Returns true if all pod files are ok, or false if any fail.
87
88 all_pod_files( [@dirs] )
89
90 Returns a list of all the Perl files in $dir and in directories below.
91 If no directories are passed, it defaults to blib if blib exists, or
92 else lib if not. Skips any files in CVS or .svn directories.
93
94 A Perl file is:
95
96 * Any file that ends in .PL, .pl, .pm, .pod or .t.
97 * Any file that has a first line with a shebang and "perl" on it.
98
99 The order of the files returned is machine-dependent. If you want them
100 sorted, you'll have to sort them yourself.
101
103 STUFF TO DO
104
105 Note the changes that are being made.
106
107 Note that you no longer can test for "no pod".
108
110 Currently maintained by Andy Lester, "<andy at petdance.com>".
111
112 Originally by brian d foy.
113
115 Thanks to David Wheeler and Peter Edwards for contributions and to
116 "brian d foy" for the original code.
117
119 Copyright 2006, Andy Lester, All Rights Reserved.
120
121 You may use, modify, and distribute this package under the same terms
122 as Perl itself.
123
124
125
126perl v5.8.8 2006-07-19 Pod(3)