1Test::Pod(3) User Contributed Perl Documentation Test::Pod(3)
2
3
4
6 Test::Pod - check for POD errors in files
7
9 Version 1.48
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( [@entries] )
68 Checks all the files under @entries for valid POD. It runs
69 all_pod_files() on directories and assumes everything else to be a file
70 to be tested. It calls the "plan()" function for you (one test for each
71 file), so you can't have already called "plan".
72
73 If @entries is empty or not passed, the function finds all POD files in
74 files in the blib directory if it exists, or the lib directory if not.
75 A POD file is one that ends with .pod, .pl and .pm, or any file where
76 the first line looks like a shebang line.
77
78 If you're testing a module, just make a t/pod.t:
79
80 use Test::More;
81 eval "use Test::Pod 1.00";
82 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
83 all_pod_files_ok();
84
85 Returns true if all pod files are ok, or false if any fail.
86
87 all_pod_files( [@dirs] )
88 Returns a list of all the Perl files in @dirs and in directories below.
89 If no directories are passed, it defaults to blib if blib exists, or
90 else lib if not. Skips any files in CVS, .svn, .git and similar
91 directories. See %Test::Pod::ignore_dirs for a list of them.
92
93 A Perl file is:
94
95 · Any file that ends in .PL, .pl, .PL, .pm, .pod, or .t.
96
97 · Any file that has a first line with a shebang and "perl" on it.
98
99 · Any file that ends in .bat and has a first line with "--*-Perl-*--"
100 on it.
101
102 The order of the files returned is machine-dependent. If you want them
103 sorted, you'll have to sort them yourself.
104
106 STUFF TO DO
107
108 Note the changes that are being made.
109
110 Note that you no longer can test for "no pod".
111
113 Currently maintained by David E. Wheeler, "<david@justatheory.com>".
114
115 Originally by brian d foy.
116
117 Maintainer emeritus: Andy Lester, "<andy at petdance.com>".
118
120 Thanks to Andy Lester, David Wheeler, Paul Miller and Peter Edwards for
121 contributions and to "brian d foy" for the original code.
122
124 Copyright 2006-2010, Andy Lester. Some Rights Reserved.
125
126 This module is free software; you can redistribute it and/or modify it
127 under the same terms as Perl itself.
128
129
130
131perl v5.16.3 2014-08-20 Test::Pod(3)