2 eval 'exec perl -S $0 "$@"'
4 #############################################################################
5 # podchecker -- command to invoke the podchecker function in Pod::Checker
7 # Copyright (c) 1998-2000 by Bradford Appleton. All rights reserved.
8 # This file is part of "PodParser". PodParser is free software;
9 # you can redistribute it and/or modify it under the same terms
11 #############################################################################
18 podchecker - check the syntax of POD format documentation files
22 B<podchecker> [B<-help>] [B<-man>] [B<-(no)warnings>] [I<file>S< >...]
24 =head1 OPTIONS AND ARGUMENTS
30 Print a brief help message and exit.
34 Print the manual page and exit.
36 =item B<-warnings> B<-nowarnings>
38 Turn on/off printing of warnings. Repeating B<-warnings> increases the
39 warning level, i.e. more warnings are printed. Currently increasing to
40 level two causes flagging of unescaped "E<lt>,E<gt>" characters.
44 The pathname of a POD file to syntax-check (defaults to standard input).
50 B<podchecker> will read the given input files looking for POD
51 syntax errors in the POD documentation and will print any errors
52 it find to STDERR. At the end, it will print a status message
53 indicating the number of errors found.
55 Directories are ignored, an appropriate warning message is printed.
57 B<podchecker> invokes the B<podchecker()> function exported by B<Pod::Checker>
58 Please see L<Pod::Checker/podchecker()> for more details.
62 B<podchecker> returns a 0 (zero) exit status if all specified
67 B<podchecker> returns the exit status 1 if at least one of
68 the given POD files has syntax errors.
70 The status 2 indicates that at least one of the specified
71 files does not contain I<any> POD commands.
73 Status 1 overrides status 2. If you want unambigouus
74 results, call B<podchecker> with one single argument only.
78 L<Pod::Parser> and L<Pod::Checker>
82 Please report bugs using L<http://rt.cpan.org>.
84 Brad Appleton E<lt>bradapp@enteract.comE<gt>,
85 Marek Rouchal E<lt>marekr@cpan.orgE<gt>
87 Based on code for B<Pod::Text::pod2text(1)> written by
88 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
101 GetOptions
(\
%options, qw(help man warnings+ nowarnings)) || pod2usage
(2);
102 pod2usage
(1) if ($options{help
});
103 pod2usage
(-verbose
=> 2) if ($options{man
});
105 if($options{nowarnings
}) {
106 $options{warnings
} = 0;
108 elsif(!defined $options{warnings
}) {
109 $options{warnings
} = 1; # default is warnings on
112 ## Dont default to STDIN if connected to a terminal
113 pod2usage
(2) if ((@ARGV == 0) && (-t STDIN
));
115 ## Invoke podchecker()
117 @ARGV = qw(-) unless(@ARGV);
118 for my $podfile (@ARGV) {
119 if($podfile eq '-') {
120 $podfile = "<&STDIN";
123 warn "podchecker: Warning: Ignoring directory '$podfile'\n";
127 podchecker
($podfile, undef, '-warnings' => $options{warnings
});
131 printf STDERR
("%s has %d pod syntax %s.\n",
133 ($errors == 1) ?
"error" : "errors");
137 $status = 2 unless($status);
138 print STDERR
"$podfile does not contain any pod commands.\n";
141 print STDERR
"$podfile pod syntax OK.\n";