line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Multi; |
2
|
|
|
|
|
|
|
require 5.008; |
3
|
13
|
|
|
13
|
|
174775
|
use strict; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
322
|
|
4
|
13
|
|
|
13
|
|
76
|
use warnings; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
299
|
|
5
|
13
|
|
|
13
|
|
56
|
use Exporter (); |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
807
|
|
6
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK); |
7
|
|
|
|
|
|
|
$VERSION = '0.10'; |
8
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
9
|
|
|
|
|
|
|
@EXPORT = qw( pod2multi ); |
10
|
|
|
|
|
|
|
@EXPORT_OK = qw( make_options_defaults ); |
11
|
13
|
|
|
13
|
|
5791
|
use Pod::Text; |
|
13
|
|
|
|
|
471185
|
|
|
13
|
|
|
|
|
791
|
|
12
|
13
|
|
|
13
|
|
7930
|
use Pod::Man; |
|
13
|
|
|
|
|
92609
|
|
|
13
|
|
|
|
|
419
|
|
13
|
13
|
|
|
13
|
|
5593
|
use Pod::Html; |
|
13
|
|
|
|
|
345302
|
|
|
13
|
|
|
|
|
756
|
|
14
|
13
|
|
|
13
|
|
92
|
use Carp; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
520
|
|
15
|
13
|
|
|
13
|
|
66
|
use File::Basename; |
|
13
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
521
|
|
16
|
13
|
|
|
13
|
|
68
|
use File::Path; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
559
|
|
17
|
13
|
|
|
13
|
|
98
|
use File::Spec; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
234
|
|
18
|
13
|
|
|
|
|
9923
|
use File::Save::Home qw( |
19
|
|
|
|
|
|
|
get_home_directory |
20
|
13
|
|
|
13
|
|
5582
|
); |
|
13
|
|
|
|
|
211579
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub pod2multi { |
23
|
19
|
100
|
|
19
|
1
|
89003
|
croak "Must supply even number of arguments: list of key-value pairs" |
24
|
|
|
|
|
|
|
if @_ % 2; |
25
|
18
|
|
|
|
|
119
|
my %args = @_; |
26
|
|
|
|
|
|
|
croak "Must supply source file with pod" |
27
|
18
|
100
|
100
|
|
|
615
|
unless (exists $args{source} and -f $args{source}); |
28
|
|
|
|
|
|
|
|
29
|
16
|
|
|
|
|
59
|
my $pod = $args{source}; |
30
|
16
|
|
|
|
|
99
|
my @text_and_man = qw(text man); |
31
|
16
|
|
|
|
|
60
|
my @all_formats_accepted = (@text_and_man, q{html}); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# to pull in any %params defined in .pod2multirc |
34
|
16
|
|
|
|
|
41
|
our %params; |
35
|
16
|
|
|
|
|
85
|
my $homedir = get_home_directory(); |
36
|
16
|
|
|
|
|
332
|
my $personal_defaults_file = "$homedir/.pod2multirc"; |
37
|
16
|
100
|
|
|
|
710
|
require $personal_defaults_file if -f $personal_defaults_file; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# At this point, if the personal defaults file exists, %params |
40
|
|
|
|
|
|
|
# should be populated with any values defined in the %params in that |
41
|
|
|
|
|
|
|
# defaults file. Those values will be overriden with any defined in a |
42
|
|
|
|
|
|
|
# Perl script and passed to pod2multi() as arguments. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# if (defined %params) { |
45
|
16
|
100
|
|
|
|
88
|
if (%params) { |
46
|
5
|
|
|
|
|
21
|
foreach my $outputformat (keys %params) { |
47
|
|
|
|
|
|
|
croak "Value of personal defaults option $outputformat must be a hash ref" |
48
|
6
|
100
|
|
|
|
268
|
unless ref($params{$outputformat}) eq 'HASH'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
15
|
100
|
|
|
|
65
|
if (exists $args{options}) { |
53
|
|
|
|
|
|
|
croak "Options must be supplied in a hash ref" |
54
|
10
|
100
|
|
|
|
145
|
unless ref($args{options}) eq 'HASH'; |
55
|
9
|
|
|
|
|
24
|
my %ao = %{$args{options}}; |
|
9
|
|
|
|
|
44
|
|
56
|
9
|
|
|
|
|
35
|
for my $outputmode (keys %ao) { |
57
|
|
|
|
|
|
|
croak "Value of option $outputmode must be a hash ref" |
58
|
8
|
100
|
|
|
|
132
|
unless ref($ao{$outputmode}) eq 'HASH'; |
59
|
7
|
|
|
|
|
17
|
my %attr = %{$ao{$outputmode}}; |
|
7
|
|
|
|
|
87
|
|
60
|
7
|
|
|
|
|
29
|
for my $attribute (keys %attr) { |
61
|
7
|
|
|
|
|
34
|
$params{$outputmode}{$attribute} = $attr{$attribute}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
13
|
|
|
|
|
753
|
my ($basename, $path, $suffix) |
67
|
|
|
|
|
|
|
= fileparse($pod, ( qr/\.pm/, qr/\.pl/, qr/\.pod/ ) ); |
68
|
13
|
|
|
|
|
61
|
my $manext; |
69
|
13
|
100
|
|
|
|
63
|
if ($suffix) { |
70
|
12
|
100
|
|
|
|
58
|
if ($suffix =~ /\.pm/) { |
71
|
1
|
|
|
|
|
2
|
$manext = q{.3}; |
72
|
|
|
|
|
|
|
} else { |
73
|
11
|
|
|
|
|
29
|
$manext = q{.1}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} else { |
76
|
1
|
|
|
|
|
2
|
$manext = q{.1}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
13
|
|
|
|
|
28
|
my %options; |
80
|
|
|
|
|
|
|
# For text and man, the only things which need special attention are the |
81
|
|
|
|
|
|
|
# directory, file name and extension; |
82
|
|
|
|
|
|
|
# everything else in %options is passed directly to the underlying |
83
|
|
|
|
|
|
|
# function. |
84
|
13
|
|
|
|
|
69
|
for my $f (@text_and_man) { |
85
|
26
|
100
|
|
|
|
105
|
$options{$f} = exists $params{$f} ? $params{$f} : {}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
13
|
|
|
|
|
25
|
my %outputpaths; |
89
|
13
|
|
|
|
|
34
|
for my $f (@text_and_man) { |
90
|
26
|
100
|
|
|
|
75
|
if (exists $options{$f}{outputpath}) { |
91
|
2
|
100
|
|
|
|
30
|
if (-d $options{$f}{outputpath}) { |
92
|
1
|
|
|
|
|
3
|
$outputpaths{$f} = $options{$f}{outputpath}; |
93
|
|
|
|
|
|
|
} else { |
94
|
1
|
|
|
|
|
17
|
warn "$options{$f}{outputpath} is not a valid directory; reverting to $path"; |
95
|
1
|
|
|
|
|
12
|
$outputpaths{$f} = $path; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} else { |
98
|
24
|
|
|
|
|
48
|
$outputpaths{$f} = $path; |
99
|
|
|
|
|
|
|
} |
100
|
26
|
100
|
|
|
|
127
|
$outputpaths{$f} .= q{/} if $outputpaths{$f} !~ m{/$}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# text |
104
|
13
|
|
|
|
|
33
|
my $tparser = Pod::Text->new(%{$options{text}}); |
|
13
|
|
|
|
|
167
|
|
105
|
13
|
|
|
|
|
2802
|
$tparser->parse_from_file( |
106
|
|
|
|
|
|
|
$pod, "$outputpaths{text}$basename.txt" |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# man |
110
|
13
|
|
|
|
|
139553
|
my $mparser = Pod::Man->new(%{$options{man}}); |
|
13
|
|
|
|
|
177
|
|
111
|
13
|
|
|
|
|
3405
|
$mparser->parse_from_file( |
112
|
|
|
|
|
|
|
$pod, "$outputpaths{man}$basename$manext" |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# html |
116
|
|
|
|
|
|
|
# html works differently. We first populate %options. |
117
|
13
|
100
|
|
|
|
170186
|
if (defined $params{html}{infile}) { |
118
|
1
|
|
|
|
|
238
|
croak "You cannot define a source file for the HTML output different from that of the text and man outputs"; |
119
|
|
|
|
|
|
|
} |
120
|
12
|
100
|
|
|
|
32
|
%{$options{html}} = %{$params{html}} ? %{$params{html}} : (); |
|
12
|
|
|
|
|
50
|
|
|
12
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
7
|
|
121
|
12
|
|
|
|
|
40
|
$options{html}{infile} = $pod; |
122
|
|
|
|
|
|
|
$options{html}{outfile} = "$path$basename.html" |
123
|
12
|
100
|
|
|
|
78
|
unless defined $params{html}{outfile}; |
124
|
|
|
|
|
|
|
$options{html}{title} = defined $params{html}{title} |
125
|
|
|
|
|
|
|
? $params{html}{title} |
126
|
12
|
100
|
|
|
|
65
|
: $basename; |
127
|
|
|
|
|
|
|
# Then we compose the long-options-style string to be passed to the |
128
|
|
|
|
|
|
|
# underlying function. |
129
|
12
|
|
|
|
|
25
|
my @htmlargs; |
130
|
12
|
|
|
|
|
24
|
foreach my $htmlopt (keys %{$options{html}}) { |
|
12
|
|
|
|
|
45
|
|
131
|
36
|
|
|
|
|
102
|
push @htmlargs, "--${htmlopt}=$options{html}{$htmlopt}"; |
132
|
|
|
|
|
|
|
} |
133
|
12
|
|
|
|
|
113
|
Pod::Html::pod2html( @htmlargs ); |
134
|
|
|
|
|
|
|
|
135
|
12
|
|
|
|
|
187312
|
return 1; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub make_options_defaults { |
139
|
1
|
|
|
1
|
1
|
4663
|
my $optionsref = shift; |
140
|
1
|
|
|
|
|
6
|
my $homedir = get_home_directory(); |
141
|
1
|
|
|
|
|
23
|
my $personal_defaults_file = "$homedir/.pod2multirc"; |
142
|
1
|
50
|
|
|
|
49
|
open my $FH, ">$personal_defaults_file" or |
143
|
|
|
|
|
|
|
croak "Unable to open handle to $personal_defaults_file"; |
144
|
1
|
|
|
|
|
533
|
require Data::Dumper; |
145
|
1
|
|
|
|
|
4343
|
local $Data::Dumper::Indent=1; |
146
|
1
|
|
|
|
|
3
|
local $Data::Dumper::Terse=1; |
147
|
1
|
|
|
|
|
6
|
print $FH '%params = '; |
148
|
1
|
|
|
|
|
2
|
print {$FH} Data::Dumper->Dump( [ $optionsref ], [ qw/*options/ ] ); |
|
1
|
|
|
|
|
8
|
|
149
|
1
|
|
|
|
|
58
|
print $FH ";\n"; |
150
|
1
|
50
|
|
|
|
28
|
close $FH or croak "Unable to close handle to $personal_defaults_file"; |
151
|
1
|
|
|
|
|
45
|
return 1; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
#################### DOCUMENTATION #################### |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 NAME |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Pod::Multi - pod2man, pod2text, pod2html simultaneously |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SYNOPSIS |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
From the command-line: |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
pod2multi file_with_pod |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
or: |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
pod2multi file_with_pod Title for HTML Version |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Inside a Perl program: |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
use Pod::Multi; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
pod2multi("/path/to/file_with_pod"); |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
or: |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
%options = ( |
181
|
|
|
|
|
|
|
text => { |
182
|
|
|
|
|
|
|
sentence => 0, |
183
|
|
|
|
|
|
|
width => 78, |
184
|
|
|
|
|
|
|
outputpath => "/outputpath/for/text/", |
185
|
|
|
|
|
|
|
... |
186
|
|
|
|
|
|
|
}, |
187
|
|
|
|
|
|
|
man => { |
188
|
|
|
|
|
|
|
manoption1 => 'manvalue1', |
189
|
|
|
|
|
|
|
manoption2 => 'manvalue2', |
190
|
|
|
|
|
|
|
outputpath => "/outputpath/for/man/", |
191
|
|
|
|
|
|
|
... |
192
|
|
|
|
|
|
|
}, |
193
|
|
|
|
|
|
|
html => { |
194
|
|
|
|
|
|
|
infile => "/path/to/infile", |
195
|
|
|
|
|
|
|
outfile => "/path/to/outfile", |
196
|
|
|
|
|
|
|
title => "Title for HTML", |
197
|
|
|
|
|
|
|
... |
198
|
|
|
|
|
|
|
}, |
199
|
|
|
|
|
|
|
); |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
pod2multi( |
202
|
|
|
|
|
|
|
source => "/path/to/file_with_pod", |
203
|
|
|
|
|
|
|
options => \%options, |
204
|
|
|
|
|
|
|
); |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
use Pod::Multi qw(make_options_defaults); |
207
|
|
|
|
|
|
|
make_options_defaults( \%options ); |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 DESCRIPTION |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
When you install a Perl module from CPAN, documentation gets installed which |
212
|
|
|
|
|
|
|
is readable with F and (at least on *nix-like systems) with F as |
213
|
|
|
|
|
|
|
well. You can convert that documentation to text and HTML formats with two |
214
|
|
|
|
|
|
|
utilities that come along with Perl: F and F. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
In production environments documentation of Perl I tends to be less |
217
|
|
|
|
|
|
|
rigorous than that of CPAN modules. If you want to convince your co-workers |
218
|
|
|
|
|
|
|
of the value of writing documentation for such programs, you may want a |
219
|
|
|
|
|
|
|
painless way to generate that documentation in a variety of formats. If you |
220
|
|
|
|
|
|
|
already know how to write documentation in Perl's Plain Old Documentation |
221
|
|
|
|
|
|
|
(POD) format, Pod::Multi will save you some keystrokes by simultaneously |
222
|
|
|
|
|
|
|
generating documentation in manpage, plain-text and HTML formats from a |
223
|
|
|
|
|
|
|
source file containing POD. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
In its current version, Pod::Multi generates those documentary files in the same |
226
|
|
|
|
|
|
|
directory as the source file. It does not attempt to install those files |
227
|
|
|
|
|
|
|
anywhere else. In particular, it does not attempt to install the manpage |
228
|
|
|
|
|
|
|
version in a MANPATH directory. This may change in a future version, but for |
229
|
|
|
|
|
|
|
the time being, we're keeping it simple. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Pod::Multi is intended to be used primarily via its associated command-line |
232
|
|
|
|
|
|
|
utility, F. F requires only one argument: the path to |
233
|
|
|
|
|
|
|
a file containing documentation in POD format. In the interest of simplicity, |
234
|
|
|
|
|
|
|
any other arguments provided on the command-line are concatenated into a |
235
|
|
|
|
|
|
|
wordspace-separated string which will serve as the title tag of the HTML |
236
|
|
|
|
|
|
|
version of the documentation. No other options are offered because, in the |
237
|
|
|
|
|
|
|
author's opinion, if you want more options you'll probably use as many |
238
|
|
|
|
|
|
|
keystrokes as you would if you ran F, F or F |
239
|
|
|
|
|
|
|
individually. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
The functional interface may be used inside Perl |
242
|
|
|
|
|
|
|
programs and, if you have personal preferences for the options you would |
243
|
|
|
|
|
|
|
normally provide to F, F or F, you can specify |
244
|
|
|
|
|
|
|
them in the functional interface. If you have a strong set of personal |
245
|
|
|
|
|
|
|
preferences as to how you like your text, manpage and HTML versions of your |
246
|
|
|
|
|
|
|
POD to look, you can even save them with the C |
247
|
|
|
|
|
|
|
function, which stores those options in a F<.pod2multirc> file in an |
248
|
|
|
|
|
|
|
appropriate place underneath your home directory. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 USAGE |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 Command-Line Interface: F |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head3 Default Case |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
pod2multi file_with_pod |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Will create files called F, F and |
259
|
|
|
|
|
|
|
F in the same directory where F is located. |
260
|
|
|
|
|
|
|
You must have write permissions to that directory. The name F |
261
|
|
|
|
|
|
|
cannot contain wordspaces. Unless you have saved a F<.pod2multirc> personal |
262
|
|
|
|
|
|
|
defaults file under your home directory, these files will be created with |
263
|
|
|
|
|
|
|
the default options you would get by calling F, F and |
264
|
|
|
|
|
|
|
F individually. This in turn means the the files so generated will |
265
|
|
|
|
|
|
|
follow the format of the Pod::Man, Pod::Text and Pod::Html modules you have |
266
|
|
|
|
|
|
|
installed on your system. The title tag in the HTML version will be |
267
|
|
|
|
|
|
|
C. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head3 Provide Title Tag for HTML Version |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
pod2multi file_with_pod Title for HTML Version |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Exactly the same as the default case, with one exception: the title tag in |
274
|
|
|
|
|
|
|
the HTML version will be C. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head2 Functional Interface: C |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
When called into a Perl program via C |
279
|
|
|
|
|
|
|
automatically exports a single function: C. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head3 Default Case: Single Argument |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
pod2multi("/path/to/file_with_pod"); |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
This is analogous to the default case in the command-line interface (above). |
286
|
|
|
|
|
|
|
If C is supplied with just one argument, it assumes that that argument |
287
|
|
|
|
|
|
|
is the path to a file containing documentation in POD format and proceeds to |
288
|
|
|
|
|
|
|
create files called F, F and |
289
|
|
|
|
|
|
|
F in directory F (assuming that directory is |
290
|
|
|
|
|
|
|
writable). The title tag for the HTML version will be C. |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head3 Alternative Case: Multiple Arguments in List of Key-Value Pairs |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
This is how Pod::Multi works internally; otherwise it's only recommended for |
295
|
|
|
|
|
|
|
people who have strong preferences. Arguments can be provided to |
296
|
|
|
|
|
|
|
F in a list of key-value pairs subject to the following |
297
|
|
|
|
|
|
|
requirements: |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=over 4 |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item * C |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
The C |
304
|
|
|
|
|
|
|
containing documentation in the POD format. |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=item * C |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
The C key is, of course, optional. (But why would you use the |
309
|
|
|
|
|
|
|
multiple argument version unless you wanted to specify options?) The value of |
310
|
|
|
|
|
|
|
the C key must be a reference to an hash (named or anonymous) which |
311
|
|
|
|
|
|
|
holds a list of key-value pairs. The elements in that hash are as follows: |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=over 4 |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=item * C<$options{text}> |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
With one exception, the key-value pairs are those you would normally supply to |
318
|
|
|
|
|
|
|
C. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
text => { |
321
|
|
|
|
|
|
|
sentence => 0, |
322
|
|
|
|
|
|
|
width => 78, |
323
|
|
|
|
|
|
|
... |
324
|
|
|
|
|
|
|
}, |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
The exception is that if you wish to specify a directory |
327
|
|
|
|
|
|
|
for the creation of the output file, you may do so with the C |
328
|
|
|
|
|
|
|
option. |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
text => { |
331
|
|
|
|
|
|
|
outputpath => /path/to/textoutput/, |
332
|
|
|
|
|
|
|
... |
333
|
|
|
|
|
|
|
}, |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Internally, C prepends this to the basename of the |
336
|
|
|
|
|
|
|
source file and provides the result as the second argument to |
337
|
|
|
|
|
|
|
C. Note that this is a directory where the |
338
|
|
|
|
|
|
|
output file will reside -- I the full path to that file. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=item * C<$options{man}> |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
With one exception, the key-value pairs are those you would normally supply to |
343
|
|
|
|
|
|
|
C. |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
man => { |
346
|
|
|
|
|
|
|
release => $VERSION, |
347
|
|
|
|
|
|
|
section => 8, |
348
|
|
|
|
|
|
|
... |
349
|
|
|
|
|
|
|
}, |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
The exception is that if you wish to specify a directory |
352
|
|
|
|
|
|
|
for the creation of the output file, you may do so with the C |
353
|
|
|
|
|
|
|
option. |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
man => { |
356
|
|
|
|
|
|
|
outputpath => /path/to/manoutput/, |
357
|
|
|
|
|
|
|
... |
358
|
|
|
|
|
|
|
}, |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
Internally, C prepends this to the basename of the |
361
|
|
|
|
|
|
|
source file and provides the result as the second argument to |
362
|
|
|
|
|
|
|
C. Note that this is a directory where the |
363
|
|
|
|
|
|
|
output file will reside -- I the full path to that file. |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=item * C<$options{html}> |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
The C option works in the same way as and , except that |
368
|
|
|
|
|
|
|
there is no sub-option. That's because the key-value pairs which |
369
|
|
|
|
|
|
|
should be supplied via hash reference to C<$options{html} are the contents of |
370
|
|
|
|
|
|
|
the ''long options'' normally supplied to C. That |
371
|
|
|
|
|
|
|
function, which calls internally, expects arguments in the long |
372
|
|
|
|
|
|
|
option format: |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
--infile=/path/to/source, |
375
|
|
|
|
|
|
|
--outfile=/path/to/htmloutput, |
376
|
|
|
|
|
|
|
--title="Title for HTML", |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
... rather than in list-of-key-value-pairs format. For consistency, |
379
|
|
|
|
|
|
|
C expects arguments to C<$options{html}> in the same format as to |
380
|
|
|
|
|
|
|
C<$options{text}> and C<$options{man}>, then converts them internally to the |
381
|
|
|
|
|
|
|
long options needed by C. |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
html => { |
384
|
|
|
|
|
|
|
infile => "/path/to/source", |
385
|
|
|
|
|
|
|
outfile => "/path/to/htmloutput", |
386
|
|
|
|
|
|
|
title => "Title for HTML", |
387
|
|
|
|
|
|
|
... |
388
|
|
|
|
|
|
|
}, |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=back |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=back |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=head3 C |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
If you have strong preferences as to how you like your manpage, text and HTML |
397
|
|
|
|
|
|
|
manuals to look, you can have F produce the same results everytime |
398
|
|
|
|
|
|
|
by saving your chosen defaults in a file called F<.pod2multirc> which is |
399
|
|
|
|
|
|
|
stored underneath your home directory. Place your preferences in a |
400
|
|
|
|
|
|
|
C<%options> with C, C and/or C keys as needed. Then pass a |
401
|
|
|
|
|
|
|
reference to that hash to C and call that function in |
402
|
|
|
|
|
|
|
a Perl program. |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
The place where <.pod2multirc> will be stored is determined by a call to |
405
|
|
|
|
|
|
|
C. File::Save::Home, by the same |
406
|
|
|
|
|
|
|
author as Pod::Multi and available from CPAN, is a pre-requisite to |
407
|
|
|
|
|
|
|
Pod::Multi. |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
C is I exported by default. You must explicitly |
410
|
|
|
|
|
|
|
request it with: |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
use Pod::Multi qw( C ); |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=head1 PREREQUISITES |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=head2 Perl Core Modules |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Carp |
419
|
|
|
|
|
|
|
Data::Dumper |
420
|
|
|
|
|
|
|
File::Basename |
421
|
|
|
|
|
|
|
File::Path |
422
|
|
|
|
|
|
|
File::Spec |
423
|
|
|
|
|
|
|
Pod::Html |
424
|
|
|
|
|
|
|
Pod::Man |
425
|
|
|
|
|
|
|
Pod::Text |
426
|
|
|
|
|
|
|
Test::Simple |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=head2 CPAN Modules |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
File::Save::Home |
431
|
|
|
|
|
|
|
IO::Capture |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=head1 BUGS |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
None reported yet. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head1 SUPPORT |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
Contact author at his cpan [dot] org address below. |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=head1 AUTHOR |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
James E Keenan |
444
|
|
|
|
|
|
|
CPAN ID: JKEENAN |
445
|
|
|
|
|
|
|
jkeenan@cpan.org |
446
|
|
|
|
|
|
|
http://search.cpan.org/~jkeenan/ |
447
|
|
|
|
|
|
|
http://thenceforward.net/perl/modules/Pod-Multi/ |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Steven Lembark made the suggestion about submitting all modules needed to a |
452
|
|
|
|
|
|
|
C at the start of the very first test. |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
David H Adler and David A Golden assisted with debugging. |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=head1 COPYRIGHT |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Copyright 2006-2017 James E Keenan. All rights reserved. |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
This program is free software; you can redistribute |
461
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
The full text of the license can be found in the |
464
|
|
|
|
|
|
|
LICENSE file included with this module. |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head1 SEE ALSO |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
perl(1). perldoc(1). man(1). |
469
|
|
|
|
|
|
|
pod2man(1). pod2text(1). pod2html(1). |
470
|
|
|
|
|
|
|
Pod::Man(3pm). Pod::Text(3pm). Pod::Html(3pm). |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=cut |