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