5 pod.pl - check the POD documentation syntax in modules and scripts
9 B<pod.pl> [B<-d|--dir> path ] [B<-v|--verbose>] B<-b|--blankline>
14 Checks Plain Old Documentation (POD) with highest possible stringency
15 in every bioperl module and script in CVS modules 'core' and 'run'.
17 Amounts to same as running
19 podchecker -warnings -warnings
25 The results are written into file '/tmp/bioperl_pod_check' and
26 displayed after the run. The output is filtered not to show
27 confirmations of correct syntax. The result file is not removed.
29 The aim is to have as few warnings, and no errors, as possible. Links
30 to web URLs give a warning but that seems to be spurious, so they are
31 filtered out. Currently there are a few cases of "multiple occurrence
32 of link target" in several modules which are harmless.
36 L<podchecker>, L<Pod::Checker>
49 ## Directories to check
51 my @dirs = qw( ../Bio/ ../scripts . );
53 # command line options
54 my ($verbose, $blankline, $dir, $help) = (0, undef, undef, undef);
56 'v|verbose' => \
$verbose,
58 'blankline' => \
$blankline,
59 'h|help|?' => sub{ exec('perldoc',$0); exit(0) }
63 my $tmpfile = '/tmp/bioperl_pod_check';
64 our %POD_CHECKER_OPTIONS = ( '-warnings' => 2 );
65 our %FIND_OPTIONS = ( wanted
=> \
&podcheck
, no_chdir
=> 1 );
68 open (F
, ">$tmpfile") || die "can't open file $tmpfile: $!";
69 $FIND_OPTIONS{wanted
} = \
&blankline
if $blankline;
72 find \
%FIND_OPTIONS, $dir;
74 find \
%FIND_OPTIONS, @dirs;
77 open (F
, "grep -v OK $tmpfile|") || die "can't open file $tmpfile: $!";
78 while (<F
>) { print unless /http/ and /non-escaped/ }
81 # this is where the action is
83 return unless /\.PLS$/ or /\.p[ml]$/ ;
85 print "$_\n" if $verbose;
86 my $checker = Pod
::Checker
->new( %POD_CHECKER_OPTIONS );
87 $checker->parse_from_file($_, \
*F
);
88 print "$_\tno POD\n" if $checker->num_errors() < 0;
95 =item B<-d | --dir> path
97 Overides the default directories to check by one directory 'path' and
98 all its subdirectories.
100 =item B<-b | --blankline>
102 Checks POD command paragraphs (lines starting with '=' character) for
103 preceding nonblank lines. These lines are printed out with '++'.
105 Also, if verbose is turned on, it will report on lines whitespace
106 characters which prevent paragrafs to be recognised by older POD
107 parsers (marked with '+'). Modern perlpod parsers (5.6.0 and later, I
108 suppose) allow for whitespace lines surrounding command lines, but
109 since bioperl still supports older versions, these lines should be
110 cleaned to contain only '\n' and no space or tab characters.
119 return unless /\.PLS$/ or /\.p[ml]$/ ;
122 open (F
, $_) or warn "can't open file $_: $!" && return;
125 print "$file: +|$1|\n" if /[ \t]\n(=[a-z][^\n]+$)/m and $verbose;
126 print "$file: ++|$1|\n" if /\w\n(=[a-z][^\n]+$)/m and $verbose;
127 print "$file:|$1|+\n" if /(^=[a-z][^\n]+)\n[\t ]/m;
128 #print "$file:|$1|++\n" if /(^=[^\n]+)\n\w/m;
135 =item B<-v | --verbose>
137 Show the progress through files during the POD checking.
139 =item B<-? | -h | --help>
149 User feedback is an integral part of the evolution of this and other
150 Bioperl modules. Send your comments and suggestions preferably to
151 the Bioperl mailing list. Your participation is much appreciated.
153 bioperl-l@bioperl.org - General discussion
154 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
156 =head2 Reporting Bugs
158 Report bugs to the Bioperl bug tracking system to help us keep track
159 of the bugs and their resolution. Bug reports can be submitted via the
162 https://github.com/bioperl/bioperl-live/issues
164 =head1 AUTHOR - Heikki Lehvaslaiho
166 Email heikki-at-bioperl-dot-org
171 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|" if /(\s\s^=[^\n]+$)/m ; }' ;
173 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|\n" if /(^=[^\n]+\n[\t ])/m ; }' ;