1Pod(3) User Contributed Perl Documentation Pod(3)
2
3
4
6 Test::Pod - check for POD errors in files
7
9 Version 1.40
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
20 distribution:
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
52 "Pod::Simple" to do the heavy lifting.
53
55 pod_file_ok( FILENAME[, TESTNAME ] )
56 "pod_file_ok()" will okay the test if the POD parses correctly.
57 Certain conditions are not reported yet, such as a file with no pod in
58 it at all.
59
60 When it fails, "pod_file_ok()" will show any pod checking errors as
61 diagnostics.
62
63 The optional second argument TESTNAME is the name of the test. If it
64 is omitted, "pod_file_ok()" chooses a default test name "POD test for
65 FILENAME".
66
67 all_pod_files_ok( [@files/@directories] )
68 Checks all the files in @files for valid POD. It runs all_pod_files()
69 on each file/directory, and calls the "plan()" function for you (one
70 test for each function), so you can't have already called "plan".
71
72 If @files is empty or not passed, the function finds all POD files in
73 the blib directory if it exists, or the lib directory if not. A POD
74 file is one that ends with .pod, .pl and .pm, or any file where the
75 first line looks like a shebang line.
76
77 If you're testing a module, just make a t/pod.t:
78
79 use Test::More;
80 eval "use Test::Pod 1.00";
81 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
82 all_pod_files_ok();
83
84 Returns true if all pod files are ok, or false if any fail.
85
86 all_pod_files( [@dirs] )
87 Returns a list of all the Perl files in $dir and in directories below.
88 If no directories are passed, it defaults to blib if blib exists, or
89 else lib if not. Skips any files in CVS, .svn, .git and similar
90 directories. See %Test::Pod::ignore_dirs for a list of them.
91
92 A Perl file is:
93
94 · Any file that ends in .PL, .pl, .pm, .pod or .t.
95
96 · Any file that has a first line with a shebang and "perl" on it.
97
98 The order of the files returned is machine-dependent. If you want them
99 sorted, you'll have to sort them yourself.
100
102 STUFF TO DO
103
104 Note the changes that are being made.
105
106 Note that you no longer can test for "no pod".
107
109 Currently maintained by Andy Lester, "<andy at petdance.com>".
110
111 Originally by brian d foy.
112
114 Thanks to David Wheeler, Paul Miller and Peter Edwards for
115 contributions and to "brian d foy" for the original code.
116
118 Copyright 2006-2009, Andy Lester, All Rights Reserved.
119
120 You may use, modify, and distribute this package under the terms as the
121 Artistic License v2.0 or GNU Public License v2.0.
122
123
124
125perl v5.10.1 2009-07-13 Pod(3)