4 use File::Basename qw(&basename &dirname);
7 # List explicitly here the variables you want Configure to
8 # generate. Metaconfig only looks for shell variables, so you
9 # have to mention them as if they were shell variables, not
10 # %Config entries. Thus you write
12 # to ensure Configure will look for $Config{startperl}.
14 # This forces PL files to create target in same directory as PL file.
15 # This is so that make depend always knows where to find PL derivatives.
18 ($file = basename($0)) =~ s/\.PL$//;
20 if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'dos'); # "case-forgiving"
21 $file .= '.com' if $^O eq 'VMS';
23 open OUT,">$file" or die "Can't create $file: $!";
25 print "Extracting $file (with variable substitutions)\n";
27 # In this section, perl variables will be expanded during extraction.
28 # You can use $Config{...} to use Configure variables.
30 print OUT <<"!GROK!THIS!";
32 eval 'exec perl -S \$0 "\$@"'
36 # In the following, perl variables are not expanded during extraction.
38 print OUT <<'!NO!SUBS!';
39 #############################################################################
40 # podchecker -- command to invoke the podchecker function in Pod::Checker
42 # Copyright (c) 1998-2000 by Bradford Appleton. All rights reserved.
43 # This file is part of "PodParser". PodParser is free software;
44 # you can redistribute it and/or modify it under the same terms
46 #############################################################################
53 podchecker - check the syntax of POD format documentation files
57 B<podchecker> [B<-help>] [B<-man>] [B<-(no)warnings>] [I<file>S< >...]
59 =head1 OPTIONS AND ARGUMENTS
65 Print a brief help message and exit.
69 Print the manual page and exit.
71 =item B<-warnings> B<-nowarnings>
73 Turn on/off printing of warnings. Repeating B<-warnings> increases the
74 warning level, i.e. more warnings are printed. Currently increasing to
75 level two causes flagging of unescaped "E<lt>,E<gt>" characters.
79 The pathname of a POD file to syntax-check (defaults to standard input).
85 B<podchecker> will read the given input files looking for POD
86 syntax errors in the POD documentation and will print any errors
87 it find to STDERR. At the end, it will print a status message
88 indicating the number of errors found.
90 Directories are ignored, an appropriate warning message is printed.
92 B<podchecker> invokes the B<podchecker()> function exported by B<Pod::Checker>
93 Please see L<Pod::Checker/podchecker()> for more details.
97 B<podchecker> returns a 0 (zero) exit status if all specified
102 B<podchecker> returns the exit status 1 if at least one of
103 the given POD files has syntax errors.
105 The status 2 indicates that at least one of the specified
106 files does not contain I<any> POD commands.
108 Status 1 overrides status 2. If you want unambiguous
109 results, call B<podchecker> with one single argument only.
113 L<Pod::Parser> and L<Pod::Checker>
117 Please report bugs using L<http://rt.cpan.org>.
119 Brad Appleton E<lt>bradapp@enteract.comE<gt>,
120 Marek Rouchal E<lt>marekr@cpan.orgE<gt>
122 Based on code for B<Pod::Text::pod2text(1)> written by
123 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
136 GetOptions(\%options, qw(help man warnings+ nowarnings)) || pod2usage(2);
137 pod2usage(1) if ($options{help});
138 pod2usage(-verbose => 2) if ($options{man});
140 if($options{nowarnings}) {
141 $options{warnings} = 0;
143 elsif(!defined $options{warnings}) {
144 $options{warnings} = 1; # default is warnings on
147 ## Dont default to STDIN if connected to a terminal
148 pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
150 ## Invoke podchecker()
152 @ARGV = qw(-) unless(@ARGV);
153 for my $podfile (@ARGV) {
154 if($podfile eq '-') {
155 $podfile = '<&STDIN';
158 warn "podchecker: Warning: Ignoring directory '$podfile'\n";
162 podchecker($podfile, undef, '-warnings' => $options{warnings});
166 printf STDERR ("%s has %d pod syntax %s.\n",
168 ($errors == 1) ? 'error' : 'errors');
172 $status = 2 unless($status);
173 print STDERR "$podfile does not contain any pod commands.\n";
176 print STDERR "$podfile pod syntax OK.\n";
183 close OUT or die "Can't close $file: $!";
184 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
185 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';