The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Pod::XML - Module to convert POD to XML


  use Pod::XML;
  my $parser = Pod::XML->new();


This module uses Pod::Parser to parse POD and generates XML from the resulting parse stream. It uses its own format, described below.



Specify the output encoding of the XML file. Requires Encode Perl module.


The XML format is not a standardised format - if you wish to generate some standard XML format such as docbook, please use a tool such as XSLT to convert between this and that format.

The format uses the namespace "". Do not try and request this URI - it is virtual. You will get a 404.

The best way to describe the format is to show you:

  <pod xmlns="">
      <title>The first =head1 goes in here</title>
    <title>Subsequent =head1's create a sect1</title>
      Ordinary paragraphs of text create a para tag.
      Indented verbatim sections go in verbatim tags using a CDATA
      section rather than XML escaping.
      <title>=head2's go in sect2</title>
        Up to =head4 is supported (despite not really being 
        supported by pod), producing sect3 and 
        sect4 respectively for =head3 and =head4.
        Bold text goes in a <strong>strong</strong> tag.
        Italic text goes in a <emphasis>emphasis</emphasis> tag.
        Code goes in a <code>code</code> tag.
        Lists (=over, =item, =back) go in list/item/itemtext 
        tags. The itemtext element is only present if the 
        =item text is <strong>not</strong> the "*" character.

If the first =head1 is "NAME" (like standard perl modules are supposed to be) it takes the next paragraph as the document title. Other standard head elements of POD are left unchanged (particularly, the SYNOPSIS and DESCRIPTION elements of standard POD).

Pod::XML tries to be careful about nesting sects based on the head level in the original POD. Let me know if this doesn't work for you.


Original version by Matt Sergeant,

Version 0.95+ by Matt Wilson <>


Matt Wilson <>




This is free software, you may use it and distribute it under the same terms as Perl itself.