Debian Codegraph @

bin/podlint

raw
1 #!/usr/bin/perl -w
2
3 use Pod::POM;
4 use Getopt::Std;
5 use File::Basename;
6
7 my $program = basename($0);
8
9 my %opts;
10 getopts('fh', \%opts);
11 die usage() if $opts{ h };
12
13 my $file = shift || die usage();
14
15 my $parser;
16 {
17 no warnings 'once';
18 $parser = Pod::POM->new( warn => 1, code => 1 )
19 || die "$Pod::POM::ERROR\n";
20 }
21
22 my $pom = $parser->parse_file($file)
23 || die $parser->error(), "\n";
24
25 print $pom if $opts{ f };
26
27
28 sub usage {
29 return <<EOF;
30 usage: $program [-f] file
31
32 Checks Pod file for well-formedness, printing warnings to STDERR.
33 The -f option can be set to fix problems (where possible), printing
34 the modified output to STDOUT.
35 EOF
36 }
37
38 =head1 NAME
39
40 podlint - check POD for correctness using Pod::POM
41
42 =head1 SYNOPSIS
43
44 podlint MyFile.pm
45
46 =head1 DESCRIPTION
47
48 This script uses Pod::POM to parse a Pod document with full
49 warnings enabled, effectively acting as a syntax and structure
50 checker.
51
52 The -f option can be specified to have the parsed Pod Object Model
53 printed to STDOUT with any markup errors fixed. Note there are some
54 critical parse errors that can't be handled and fixed by the parser
55 and in this case the script will terminate reporting the error.
56
57 =head1 AUTHOR
58
59 Andy Wardley E<lt>[email protected]<gt>
60
61 =head1 VERSION
62
63 This is version 0.2 of podlint.
64
65 =head1 COPYRIGHT
66
67 Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
68
69 This module is free software; you can redistribute it and/or
70 modify it under the same terms as Perl itself.
71
72 =head1 SEE ALSO
73
74 For further information please see L<Pod::POM>.