line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/local/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' |
4
|
|
|
|
|
|
|
if 0; # not running under some shell |
5
|
|
|
|
|
|
|
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' |
6
|
|
|
|
|
|
|
if $running_under_some_shell; |
7
|
|
|
|
|
|
|
#!perl -w |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
3524
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
121
|
|
10
|
3
|
|
|
3
|
|
17
|
use vars qw($VERSION $TEST_MODE); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
177
|
|
11
|
|
|
|
|
|
|
$VERSION = 0.2; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
3891
|
use Getopt::Long; |
|
3
|
|
|
|
|
38515
|
|
|
3
|
|
|
|
|
30
|
|
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
540
|
use Pod::Find qw(pod_find simplify_name); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
922
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %opt = ( banner => 1 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# compatibility hack for previous version(s) of pod2html |
20
|
|
|
|
|
|
|
my %oldopt; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
die unless(GetOptions(\%opt, qw( |
23
|
|
|
|
|
|
|
banner! |
24
|
|
|
|
|
|
|
converter=s |
25
|
|
|
|
|
|
|
suffix=s |
26
|
|
|
|
|
|
|
filesuffix=s |
27
|
|
|
|
|
|
|
dir=s |
28
|
|
|
|
|
|
|
libpods=s |
29
|
|
|
|
|
|
|
navigation! |
30
|
|
|
|
|
|
|
localtoc! |
31
|
|
|
|
|
|
|
toc! |
32
|
|
|
|
|
|
|
idx! |
33
|
|
|
|
|
|
|
tocname=s |
34
|
|
|
|
|
|
|
idxname=s |
35
|
|
|
|
|
|
|
toctitle=s |
36
|
|
|
|
|
|
|
idxtitle=s |
37
|
|
|
|
|
|
|
idxopt=s |
38
|
|
|
|
|
|
|
ps! |
39
|
|
|
|
|
|
|
psdir=s |
40
|
|
|
|
|
|
|
psfont=s |
41
|
|
|
|
|
|
|
papersize=s |
42
|
|
|
|
|
|
|
inc! |
43
|
|
|
|
|
|
|
script! |
44
|
|
|
|
|
|
|
stylesheet=s |
45
|
|
|
|
|
|
|
warnings! |
46
|
|
|
|
|
|
|
verbose! |
47
|
|
|
|
|
|
|
help|h |
48
|
|
|
|
|
|
|
version|V), |
49
|
|
|
|
|
|
|
'flush' => \$oldopt{flush}, |
50
|
|
|
|
|
|
|
'htmlroot=s' => \$oldopt{htmlroot}, # can be ignored |
51
|
|
|
|
|
|
|
'index!' => \$oldopt{'index'}, |
52
|
|
|
|
|
|
|
'infile=s' => \$oldopt{infile}, |
53
|
|
|
|
|
|
|
'netscape!' => \$oldopt{netscape}, # ignore |
54
|
|
|
|
|
|
|
'outfile=s' => \$oldopt{outfile}, |
55
|
|
|
|
|
|
|
'podpath=s' => \$oldopt{podpath}, # can be ignored |
56
|
|
|
|
|
|
|
'podroot=s' => \$oldopt{podroot}, |
57
|
|
|
|
|
|
|
'recurse!' => \$oldopt{recurse}, # ignored now |
58
|
|
|
|
|
|
|
'title=s' => \$oldopt{title} |
59
|
|
|
|
|
|
|
)); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my %addopts = (); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
if($oldopt{infile}) { |
64
|
|
|
|
|
|
|
@ARGV = ( $oldopt{infile} ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
if($oldopt{outfile}) { |
68
|
|
|
|
|
|
|
$addopts{-outfile} = $oldopt{outfile}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if($oldopt{podroot}) { |
72
|
|
|
|
|
|
|
push(@ARGV, $oldopt{podroot}); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# process libpods |
76
|
|
|
|
|
|
|
if($opt{libpods}) { |
77
|
|
|
|
|
|
|
# replace single : with , (old style) |
78
|
|
|
|
|
|
|
$opt{libpods} =~ s/(?
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
if(defined $oldopt{'index'}) { |
82
|
|
|
|
|
|
|
$opt{localtoc} = $oldopt{'index'}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
if(defined $oldopt{title}) { |
86
|
|
|
|
|
|
|
$addopts{-title} = $oldopt{title}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $converter = $opt{converter} || 'Marek::Pod::HTML'; |
90
|
3
|
|
|
3
|
|
2819
|
eval "use $converter qw(pod2html);"; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
264
|
|
91
|
|
|
|
|
|
|
die "Fatal: Cannot load convertor module '$converter':\n$@\n" |
92
|
|
|
|
|
|
|
if($@); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
if($opt{help}) { |
95
|
3
|
|
|
3
|
|
19
|
use Config; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1904
|
|
96
|
|
|
|
|
|
|
exec "$Config{scriptdir}/perldoc -F $0"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
elsif($opt{version}) { |
99
|
|
|
|
|
|
|
print "$0 Version $VERSION\n"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my %pods = (); |
104
|
|
|
|
|
|
|
my @dirs = (); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
foreach(@ARGV) { |
107
|
|
|
|
|
|
|
if(-d) { |
108
|
|
|
|
|
|
|
push(@dirs,$_); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
elsif(/[*?]/) { |
111
|
|
|
|
|
|
|
foreach (glob($_)) { |
112
|
|
|
|
|
|
|
if(-d) { |
113
|
|
|
|
|
|
|
push(@dirs,$_); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
else { |
116
|
|
|
|
|
|
|
my $name = simplify_name($_); |
117
|
|
|
|
|
|
|
$pods{$_} = $name; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
else { |
122
|
|
|
|
|
|
|
my $name = simplify_name($_); |
123
|
|
|
|
|
|
|
$pods{$_} = $name; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
my %search; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
if(@dirs || $opt{inc} || $opt{script}) { |
129
|
|
|
|
|
|
|
warn "+++ Searching for POD documents\n"; |
130
|
|
|
|
|
|
|
%search = pod_find({ |
131
|
|
|
|
|
|
|
-inc => $opt{inc}, |
132
|
|
|
|
|
|
|
-script => $opt{script}, |
133
|
|
|
|
|
|
|
-verbose => $opt{verbose} |
134
|
|
|
|
|
|
|
}, @dirs) |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
map { $pods{$_} = $search{$_} } keys %search; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# run as a filter |
140
|
|
|
|
|
|
|
# we have to save it temporarily because we need two passes |
141
|
|
|
|
|
|
|
my $tmp; |
142
|
|
|
|
|
|
|
unless(%pods) { |
143
|
|
|
|
|
|
|
my $self = $0; |
144
|
|
|
|
|
|
|
$self =~ s:^.*/::; |
145
|
|
|
|
|
|
|
$tmp = "/tmp/$self.$$"; |
146
|
|
|
|
|
|
|
open(TEMP, ">$tmp") || die "Cannot write temp file: $!\n"; |
147
|
|
|
|
|
|
|
while() { |
148
|
|
|
|
|
|
|
print TEMP; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
close(TEMP); |
151
|
|
|
|
|
|
|
$pods{$tmp} = 'stdin'; |
152
|
|
|
|
|
|
|
$addopts{-filter} = 1; |
153
|
|
|
|
|
|
|
$opt{navigation} = 0 unless defined $opt{navigation}; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
warn "+++ Starting conversion\n" if($opt{verbose}); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
pod2html( { |
159
|
|
|
|
|
|
|
-banner => $opt{banner}, |
160
|
|
|
|
|
|
|
-converter => $converter, |
161
|
|
|
|
|
|
|
-suffix => $opt{suffix}, |
162
|
|
|
|
|
|
|
-filesuffix => $opt{filesuffix}, |
163
|
|
|
|
|
|
|
-dir => $opt{dir}, |
164
|
|
|
|
|
|
|
-libpods => $opt{libpods}, |
165
|
|
|
|
|
|
|
-navigation => $opt{navigation}, |
166
|
|
|
|
|
|
|
-localtoc => $opt{localtoc}, |
167
|
|
|
|
|
|
|
-toc => $opt{toc}, |
168
|
|
|
|
|
|
|
-idx => $opt{idx}, |
169
|
|
|
|
|
|
|
-tocname => $opt{tocname}, |
170
|
|
|
|
|
|
|
-idxname => $opt{idxname}, |
171
|
|
|
|
|
|
|
-toctitle => $opt{toctitle}, |
172
|
|
|
|
|
|
|
-idxtitle => $opt{idxtitle}, |
173
|
|
|
|
|
|
|
-ps => $opt{ps}, |
174
|
|
|
|
|
|
|
-psdir => $opt{psdir}, |
175
|
|
|
|
|
|
|
-psfont => $opt{psfont}, |
176
|
|
|
|
|
|
|
-papersize => $opt{papersize}, |
177
|
|
|
|
|
|
|
-warnings => $opt{warnings}, |
178
|
|
|
|
|
|
|
-verbose => $opt{verbose}, |
179
|
|
|
|
|
|
|
-stylesheet => $opt{stylesheet}, |
180
|
|
|
|
|
|
|
-idxopt => $opt{idxopt}, |
181
|
|
|
|
|
|
|
%addopts |
182
|
|
|
|
|
|
|
}, { %pods }); |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
unlink $tmp if($tmp); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
exit 0 unless($TEST_MODE); |
188
|
|
|
|
|
|
|
1; # this is for the module test |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
__END__ |