6 pod.pl - check the POD documentation syntax in modules and scripts
10 B<pod.pl> [B<-d|--dir> path ] [B<-v|--verbose>] B<-b|--blankline>
15 Checks Plain Old Documentation (POD) with highest possible stringency
16 in every bioperl module and script in CVS modules 'core' and 'run'.
18 Amounts to same as running
20 podchecker -warnings -warnings
24 You are expected to have checked out CVS module 'bioperl_all'.
25 Otherwise, bioperl-run module is not found.
30 The results are written into file '/tmp/bioperl_pod_check' and
31 displayed after the run. The output is filtered not to show
32 confirmations of correct syntax. The result file is not removed.
34 The aim is to have as few warnings, and no errors, as possible. Links
35 to web URLs give a warning but that seems to be spurious, so they are
36 filtered out. Currently there are a few cases of "multiple occurrence
37 of link target" in several modules which are harmless.
41 L<podchecker>, L<Pod::Checker>
54 ## Directories to check
56 my @dirs = qw( ../Bio/ ../../bioperl-run/Bio ../scripts ../../bioperl-run/scripts . );
58 # command line options
59 my ($verbose, $blankline, $dir, $help) = (0, undef, undef, undef);
61 'v|verbose' => \
$verbose,
63 'blankline' => \
$blankline,
64 'h|help|?' => sub{ exec('perldoc',$0); exit(0) }
68 my $tmpfile = '/tmp/bioperl_pod_check';
69 our %POD_CHECKER_OPTIONS = ( '-warnings' => 2 );
70 our %FIND_OPTIONS = ( wanted
=> \
&podcheck
, no_chdir
=> 1 );
73 open (F
, ">$tmpfile") || die "can't open file $tmpfile: $!";
74 $FIND_OPTIONS{wanted
} = \
&blankline
if $blankline;
77 find \
%FIND_OPTIONS, $dir;
79 find \
%FIND_OPTIONS, @dirs;
82 open (F
, "grep -v OK $tmpfile|") || die "can't open file $tmpfile: $!";
83 while (<F
>) { print unless /http/ and /non-escaped/ }
86 # this is where the action is
88 return unless /\.PLS$/ or /\.p[ml]$/ ;
90 print "$_\n" if $verbose;
91 my $checker = new Pod
::Checker
%POD_CHECKER_OPTIONS;
92 $checker->parse_from_file($_, \
*F
);
93 print "$_\tno POD\n" if $checker->num_errors() < 0;
100 =item B<-d | --dir> path
102 Overides the default directories to check by one directory 'path' and
103 all its subdirectories.
105 =item B<-b | --blankline>
107 Checks POD command paragraphs (lines starting with '=' character) for
108 preceding nonblank lines. These lines are printed out with '++'.
110 Also, if verbose is turned on, it will report on lines whitespace
111 characters which prevent paragrafs to be recognised by older POD
112 parsers (marked with '+'). Modern perlpod parsers (5.6.0 and later, I
113 suppose) allow for whitespace lines surrounding command lines, but
114 since bioperl still supports older versions, these lines should be
115 cleaned to contain only '\n' and no space or tab characters.
124 return unless /\.PLS$/ or /\.p[ml]$/ ;
127 open (F
, $_) or warn "can't open file $_: $!" && return;
130 print "$file: +|$1|\n" if /[ \t]\n(=[a-z][^\n]+$)/m and $verbose;
131 print "$file: ++|$1|\n" if /\w\n(=[a-z][^\n]+$)/m and $verbose;
132 print "$file:|$1|+\n" if /(^=[a-z][^\n]+)\n[\t ]/m;
133 #print "$file:|$1|++\n" if /(^=[^\n]+)\n\w/m;
140 =item B<-v | --verbose>
142 Show the progress through files during the POD checking.
144 =item B<-? | -h | --help>
154 User feedback is an integral part of the evolution of this and other
155 Bioperl modules. Send your comments and suggestions preferably to
156 the Bioperl mailing list. Your participation is much appreciated.
158 bioperl-l@bioperl.org - General discussion
159 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
161 =head2 Reporting Bugs
163 Report bugs to the Bioperl bug tracking system to help us keep track
164 of the bugs and their resolution. Bug reports can be submitted via the
167 http://bugzilla.open-bio.org/
169 =head1 AUTHOR - Heikki Lehvaslaiho
171 Email heikki-at-bioperl-dot-org
176 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|" if /(\s\s^=[^\n]+$)/m ; }' ;
178 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|\n" if /(^=[^\n]+\n[\t ])/m ; }' ;