Upgrade to Test::Simple 0.64_03
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / HTMLLegacy.pm
CommitLineData
351625bd 1
2require 5;
3package Pod::Simple::HTMLLegacy;
4use strict;
5
6use vars qw($VERSION);
7use Getopt::Long;
8
9$VERSION = "5.01";
10
11#--------------------------------------------------------------------------
12#
13# This class is meant to thinly emulate bad old Pod::Html
14#
15# TODO: some basic docs
16
17sub pod2html {
18 my @args = (@_);
19
20 my( $verbose, $infile, $outfile, $title );
21 my $index = 1;
22
23 {
24 my($help);
25
26 my($netscape); # dummy
27 local @ARGV = @args;
28 GetOptions(
29 "help" => \$help,
30 "verbose!" => \$verbose,
31 "infile=s" => \$infile,
32 "outfile=s" => \$outfile,
33 "title=s" => \$title,
34 "index!" => \$index,
35
36 "netscape!" => \$netscape,
37 ) or return bad_opts(@args);
38 bad_opts(@args) if @ARGV; # it should be all switches!
39 return help_message() if $help;
40 }
41
42 for($infile, $outfile) { $_ = undef unless defined and length }
43
44 if($verbose) {
45 warn sprintf "%s version %s\n", __PACKAGE__, $VERSION;
46 warn "OK, processed args [@args] ...\n";
47 warn sprintf
48 " Verbose: %s\n Index: %s\n Infile: %s\n Outfile: %s\n Title: %s\n",
49 map defined($_) ? $_ : "(nil)",
50 $verbose, $index, $infile, $outfile, $title,
51 ;
52 *Pod::Simple::HTML::DEBUG = sub(){1};
53 }
54 require Pod::Simple::HTML;
55 Pod::Simple::HTML->VERSION(3);
56
57 die "No such input file as $infile\n"
58 if defined $infile and ! -e $infile;
59
60
61 my $pod = Pod::Simple::HTML->new;
62 $pod->force_title($title) if defined $title;
63 $pod->index($index);
64 return $pod->parse_from_file($infile, $outfile);
65}
66
67#--------------------------------------------------------------------------
68
69sub bad_opts { die _help_message(); }
70sub help_message { print STDOUT _help_message() }
71
72#--------------------------------------------------------------------------
73
74sub _help_message {
75
76 join '',
77
78"[", __PACKAGE__, " version ", $VERSION, qq~]
79Usage: pod2html --help --infile=<name> --outfile=<name>
80 --verbose --index --noindex
81
82Options:
83 --help - prints this message.
84 --[no]index - generate an index at the top of the resulting html
85 (default behavior).
86 --infile - filename for the pod to convert (input taken from stdin
87 by default).
88 --outfile - filename for the resulting html file (output sent to
89 stdout by default).
90 --title - title that will appear in resulting html file.
91 --[no]verbose - self-explanatory (off by default).
92
93Note that pod2html is DEPRECATED, and this version implements only
94 some of the options known to older versions.
95For more information, see 'perldoc pod2html'.
96~;
97
98}
99
1001;
101__END__
102
103OVER the underpass! UNDER the overpass! Around the FUTURE and BEYOND REPAIR!!
104