xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/pod/pod2html.PL (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/usr/local/bin/perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse Config;
4*0Sstevel@tonic-gateuse File::Basename qw(&basename &dirname);
5*0Sstevel@tonic-gateuse Cwd;
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gate# List explicitly here the variables you want Configure to
8*0Sstevel@tonic-gate# generate.  Metaconfig only looks for shell variables, so you
9*0Sstevel@tonic-gate# have to mention them as if they were shell variables, not
10*0Sstevel@tonic-gate# %Config entries.  Thus you write
11*0Sstevel@tonic-gate#  $startperl
12*0Sstevel@tonic-gate# to ensure Configure will look for $Config{startperl}.
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gate# This forces PL files to create target in same directory as PL file.
15*0Sstevel@tonic-gate# This is so that make depend always knows where to find PL derivatives.
16*0Sstevel@tonic-gate$origdir = cwd;
17*0Sstevel@tonic-gatechdir dirname($0);
18*0Sstevel@tonic-gate$file = basename($0, '.PL');
19*0Sstevel@tonic-gate$file .= '.com' if $^O eq 'VMS';
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gateopen OUT,">$file" or die "Can't create $file: $!";
22*0Sstevel@tonic-gate
23*0Sstevel@tonic-gateprint "Extracting $file (with variable substitutions)\n";
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate# In this section, perl variables will be expanded during extraction.
26*0Sstevel@tonic-gate# You can use $Config{...} to use Configure variables.
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gateprint OUT <<"!GROK!THIS!";
29*0Sstevel@tonic-gate$Config{startperl}
30*0Sstevel@tonic-gate    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
31*0Sstevel@tonic-gate	if \$running_under_some_shell;
32*0Sstevel@tonic-gate!GROK!THIS!
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gate# In the following, perl variables are not expanded during extraction.
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gateprint OUT <<'!NO!SUBS!';
37*0Sstevel@tonic-gate=pod
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate=head1 NAME
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gatepod2html - convert .pod files to .html files
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate=head1 SYNOPSIS
44*0Sstevel@tonic-gate
45*0Sstevel@tonic-gate    pod2html --help --htmlroot=<name> --infile=<name> --outfile=<name>
46*0Sstevel@tonic-gate             --podpath=<name>:...:<name> --podroot=<name>
47*0Sstevel@tonic-gate             --libpods=<name>:...:<name> --recurse --norecurse --verbose
48*0Sstevel@tonic-gate             --index --noindex --title=<name>
49*0Sstevel@tonic-gate
50*0Sstevel@tonic-gate=head1 DESCRIPTION
51*0Sstevel@tonic-gate
52*0Sstevel@tonic-gateConverts files from pod format (see L<perlpod>) to HTML format.
53*0Sstevel@tonic-gate
54*0Sstevel@tonic-gate=head1 ARGUMENTS
55*0Sstevel@tonic-gate
56*0Sstevel@tonic-gatepod2html takes the following arguments:
57*0Sstevel@tonic-gate
58*0Sstevel@tonic-gate=over 4
59*0Sstevel@tonic-gate
60*0Sstevel@tonic-gate=item help
61*0Sstevel@tonic-gate
62*0Sstevel@tonic-gate  --help
63*0Sstevel@tonic-gate
64*0Sstevel@tonic-gateDisplays the usage message.
65*0Sstevel@tonic-gate
66*0Sstevel@tonic-gate=item htmlroot
67*0Sstevel@tonic-gate
68*0Sstevel@tonic-gate  --htmlroot=name
69*0Sstevel@tonic-gate
70*0Sstevel@tonic-gateSets the base URL for the HTML files.  When cross-references are made,
71*0Sstevel@tonic-gatethe HTML root is prepended to the URL.
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gate=item infile
74*0Sstevel@tonic-gate
75*0Sstevel@tonic-gate  --infile=name
76*0Sstevel@tonic-gate
77*0Sstevel@tonic-gateSpecify the pod file to convert.  Input is taken from STDIN if no
78*0Sstevel@tonic-gateinfile is specified.
79*0Sstevel@tonic-gate
80*0Sstevel@tonic-gate=item outfile
81*0Sstevel@tonic-gate
82*0Sstevel@tonic-gate  --outfile=name
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gateSpecify the HTML file to create.  Output goes to STDOUT if no outfile
85*0Sstevel@tonic-gateis specified.
86*0Sstevel@tonic-gate
87*0Sstevel@tonic-gate=item podroot
88*0Sstevel@tonic-gate
89*0Sstevel@tonic-gate  --podroot=name
90*0Sstevel@tonic-gate
91*0Sstevel@tonic-gateSpecify the base directory for finding library pods.
92*0Sstevel@tonic-gate
93*0Sstevel@tonic-gate=item podpath
94*0Sstevel@tonic-gate
95*0Sstevel@tonic-gate  --podpath=name:...:name
96*0Sstevel@tonic-gate
97*0Sstevel@tonic-gateSpecify which subdirectories of the podroot contain pod files whose
98*0Sstevel@tonic-gateHTML converted forms can be linked-to in cross-references.
99*0Sstevel@tonic-gate
100*0Sstevel@tonic-gate=item libpods
101*0Sstevel@tonic-gate
102*0Sstevel@tonic-gate  --libpods=name:...:name
103*0Sstevel@tonic-gate
104*0Sstevel@tonic-gateList of page names (eg, "perlfunc") which contain linkable C<=item>s.
105*0Sstevel@tonic-gate
106*0Sstevel@tonic-gate=item netscape
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gate  --netscape
109*0Sstevel@tonic-gate
110*0Sstevel@tonic-gateUse Netscape HTML directives when applicable.
111*0Sstevel@tonic-gate
112*0Sstevel@tonic-gate=item nonetscape
113*0Sstevel@tonic-gate
114*0Sstevel@tonic-gate  --nonetscape
115*0Sstevel@tonic-gate
116*0Sstevel@tonic-gateDo not use Netscape HTML directives (default).
117*0Sstevel@tonic-gate
118*0Sstevel@tonic-gate=item index
119*0Sstevel@tonic-gate
120*0Sstevel@tonic-gate  --index
121*0Sstevel@tonic-gate
122*0Sstevel@tonic-gateGenerate an index at the top of the HTML file (default behaviour).
123*0Sstevel@tonic-gate
124*0Sstevel@tonic-gate=item noindex
125*0Sstevel@tonic-gate
126*0Sstevel@tonic-gate  --noindex
127*0Sstevel@tonic-gate
128*0Sstevel@tonic-gateDo not generate an index at the top of the HTML file.
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate
131*0Sstevel@tonic-gate=item recurse
132*0Sstevel@tonic-gate
133*0Sstevel@tonic-gate  --recurse
134*0Sstevel@tonic-gate
135*0Sstevel@tonic-gateRecurse into subdirectories specified in podpath (default behaviour).
136*0Sstevel@tonic-gate
137*0Sstevel@tonic-gate=item norecurse
138*0Sstevel@tonic-gate
139*0Sstevel@tonic-gate  --norecurse
140*0Sstevel@tonic-gate
141*0Sstevel@tonic-gateDo not recurse into subdirectories specified in podpath.
142*0Sstevel@tonic-gate
143*0Sstevel@tonic-gate=item title
144*0Sstevel@tonic-gate
145*0Sstevel@tonic-gate  --title=title
146*0Sstevel@tonic-gate
147*0Sstevel@tonic-gateSpecify the title of the resulting HTML file.
148*0Sstevel@tonic-gate
149*0Sstevel@tonic-gate=item verbose
150*0Sstevel@tonic-gate
151*0Sstevel@tonic-gate  --verbose
152*0Sstevel@tonic-gate
153*0Sstevel@tonic-gateDisplay progress messages.
154*0Sstevel@tonic-gate
155*0Sstevel@tonic-gate=back
156*0Sstevel@tonic-gate
157*0Sstevel@tonic-gate=head1 AUTHOR
158*0Sstevel@tonic-gate
159*0Sstevel@tonic-gateTom Christiansen, E<lt>tchrist@perl.comE<gt>.
160*0Sstevel@tonic-gate
161*0Sstevel@tonic-gate=head1 BUGS
162*0Sstevel@tonic-gate
163*0Sstevel@tonic-gateSee L<Pod::Html> for a list of known bugs in the translator.
164*0Sstevel@tonic-gate
165*0Sstevel@tonic-gate=head1 SEE ALSO
166*0Sstevel@tonic-gate
167*0Sstevel@tonic-gateL<perlpod>, L<Pod::Html>
168*0Sstevel@tonic-gate
169*0Sstevel@tonic-gate=head1 COPYRIGHT
170*0Sstevel@tonic-gate
171*0Sstevel@tonic-gateThis program is distributed under the Artistic License.
172*0Sstevel@tonic-gate
173*0Sstevel@tonic-gate=cut
174*0Sstevel@tonic-gate
175*0Sstevel@tonic-gateuse Pod::Html;
176*0Sstevel@tonic-gate
177*0Sstevel@tonic-gatepod2html @ARGV;
178*0Sstevel@tonic-gate!NO!SUBS!
179*0Sstevel@tonic-gate
180*0Sstevel@tonic-gateclose OUT or die "Can't close $file: $!";
181*0Sstevel@tonic-gatechmod 0755, $file or die "Can't reset permissions for $file: $!\n";
182*0Sstevel@tonic-gateexec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
183*0Sstevel@tonic-gatechdir $origdir;
184