Debian Codegraph @

pod-minimumversion

raw
1 #!perl -w
2
3 # Copyright 2011 Kevin Ryde
4
5 # This file is part of Pod-MinimumVersion.
6 #
7 # Pod-MinimumVersion is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 3, or (at your option) any later
10 # version.
11 #
12 # Pod-MinimumVersion is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with Pod-MinimumVersion. If not, see <http://www.gnu.org/licenses/>.
19
20 use 5.004;
21 use strict;
22 use Getopt::Long;
23 use Pod::MinimumVersion;
24
25 use vars '$VERSION';
26 $VERSION = 50;
27
28 my $want_stdin = 1;
29 my $want_all = 1;
30
31 Getopt::Long::Configure ('no_ignore_case');
32 Getopt::Long::GetOptions
33 ('all' => \$want_all,
34 'help|?' => sub {
35 print <<'HERE';
36 pod-minimumversion [--options] [filename...]
37 --help print this help
38 --version print program version number
39 HERE
40 $want_stdin = 0;
41 },
42 'version' => sub {
43 print "pod-minimumversion $VERSION\n";
44 $want_stdin = 0;
45 },
46 '<>' => sub {
47 my ($arg) = @_;
48 report (filename => "$arg");
49 $want_stdin = 0;
50 },
51 )
52 or exit 1;
53
54 if ($want_stdin) {
55 report (filehandle => \*STDIN, filename => '(stdin)');
56 }
57
58 sub report {
59 my $pmv = Pod::MinimumVersion->new (@_);
60 foreach my $report ($want_all
61 ? $pmv->reports
62 : $pmv->minimum_report) {
63 print "$report->{'filename'}:$report->{'linenum'}: $report->{'version'} for $report->{'why'}\n";
64 }
65 }
66
67 exit 0;
68
69 __END__
70
71 =for stopwords Ryde Pod-MinimumVersion pod-minimumversion
72
73 =head1 NAME
74
75 pod-minimumversion -- report minimum Perl version for given POD
76
77 =head1 SYNOPSIS
78
79 pod-minimumversion [--options] [filename...]
80
81 =head1 DESCRIPTION
82
83 C<pod-minimumversion> reports the minimum Perl version required to process
84 POD directives in given files, or the standard input if no files are given.
85
86 =head1 OPTIONS
87
88 =over
89
90 =item --help, -?
91
92 Print a summary of the options.
93
94 =item --version
95
96 Print the program version number.
97
98 =back
99
100 =head1 SEE ALSO
101
102 L<Pod::MinimumVersion>
103
104 L<perlver(1)>, L<Perl::MinimumVersion>
105
106 =head1 HOME PAGE
107
108 http://user42.tuxfamily.org/pod-minimumversion/index.html
109
110 =head1 LICENSE
111
112 Pod-MinimumVersion is Copyright 2009, 2010, 2011 Kevin Ryde
113
114 Pod-MinimumVersion is free software; you can redistribute it and/or modify
115 it under the terms of the GNU General Public License as published by the
116 Free Software Foundation; either version 3, or (at your option) any later
117 version.
118
119 Pod-MinimumVersion is distributed in the hope that it will be useful, but
120 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
121 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
122 more details.
123
124 You should have received a copy of the GNU General Public License along with
125 Pod-MinimumVersion. If not, see <http://www.gnu.org/licenses/>.
126
127 =cut