8

I need to convert Pod to HTML. There are number of Pod::HTML and Pod::Simple::* modules. Which one is the one I should use?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Eric Johnson
  • 17,502
  • 10
  • 52
  • 59
  • 4
    And the command `pod2html` is no use? It contains two lines of operational code: `use Pod::Html; pod2html @ARGV;` – Jonathan Leffler Jul 24 '11 at 19:42
  • 1
    The HTML output for Pod::Html is not bad. It works if you just want something quick and dirty. But it doesn't let you set a header/footer on your html files. Also I think its possible, but after 30 min, I still couldn't get pod to link to each other correctly. Also Pod::Simple::XHTML just has a lot more options. – Eric Johnson Aug 20 '11 at 06:20

1 Answers1

12

The short answer is Pod::Simple::XHTML. It produces useful yet concise HTML output. You can see an example of the output by viewing the html source at http://metacpan.org.

It also works with Pod::Simple::HTMLBatch which you should check out if you are converting more than one file. Note that the default for Pod::Simple::HTMLBatch is Pod::Simple::HTML. But the maintainer of Pod::Simple, David Wheeler, recommends using Pod::Simple::XHTML.

use Pod::Simple::HTMLBatch;    
use Pod::Simple::XHTML;

mkdir './html' or die "could not create directory: $!";

my $convert = Pod::Simple::HTMLBatch->new;
$convert->html_render_class('Pod::Simple::XHTML');
$convert->add_css('http://www.perl.org/css/perl.css');
$convert->css_flurry(0);
$convert->javascript_flurry(0);
$convert->contents_file(0);    
$convert->batch_convert('./pod', './html');
Eric Johnson
  • 17,502
  • 10
  • 52
  • 59