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