SYNOPSIS

This module inherits from Pod::Parser, hence you can use this familiar interface:

        use Pod::Xhtml;
        my $parser = new Pod::Xhtml;
        $parser->parse_from_file( $infile, $outfile );

        # or use filehandles instead
        $parser->parse_from_filehandle($in_fh, $out_fh);

        # or get the XHTML as a scalar
        my $parsertoo = new Pod::Xhtml( StringMode => 1 );
        $parsertoo->parse_from_file( $infile, $outfile );
        my $xhtml = $parsertoo->asString;

        # or get a reference to the XHTML string
        my $xhtmlref = $parsertoo->asStringRef;

        # to parse some other pod file to another output file all you need to do is...
        $parser->parse_from_file( $anotherinfile, $anotheroutfile );

There are options specific to Pod::Xhtml that you can pass in at construction time, e.g.:

my $parser = new Pod::Xhtml(StringMode => 1, MakeIndex => 0);

See \*(L"\s-1OPTIONS\s0\*(R". For more information also see Pod::Parser which this module inherits from.

DESCRIPTION

new Pod::Xhtml( [ \s-1OPTIONS\s0 ] )

Create a new object. Optionally pass in some options in the form 'new Pod::Xhtml( StringMode => 1);' Read \s-1POD\s0 from the input file, output to the output file (or \s-1STDOUT\s0 if no file is given). See Pod::Parser docs for more. Note that you can parse multiple files with the same object. All your options will be preserved, as will any text you added with the add*Text methods. Read \s-1POD\s0 from the input filehandle, output to the output filehandle (\s-1STDIN/STDOUT\s0 if no filehandle(s) given). See Pod::Parser docs for more. Note that you can parse multiple files with the same object. All your options will be preserved, as will any text you added with the add*Text methods. Get the \s-1XHTML\s0 as a scalar. You'll probably want to use this with the StringMode option. As above, but you get a reference to the string, not the string itself. Inserts some text just before the closing head tag. For example you can add a link to a stylesheet. May be called many times to add lots of text. Note: you need to call this some time before any output is done, e.g. straight after new(). Make sure that you only insert valid \s-1XHTML\s0 fragments. Inserts some text right at the beginning (or ending) of the body element. For example you can add a navigation header and footer. May be called many times to add lots of text. Note: you need to call this some time before any output is done, e.g. straight after new(). Make sure that you only insert valid \s-1XHTML\s0 fragments.

OPTIONS

StringMode

Default: 0. If set to 1 this does no output at all, even if filenames/handles are supplied. Use asString or asStringRef to access the text if you set this option.

MakeIndex

Default: 1. If set to 1 then an index of sections is created at the top of the body. If set to 2 then the index includes non-bulleted list items

MakeMeta

Default: 1. If set to 1 then some meta tags are created, recording things like input file, description, etc.

FragmentOnly

Default: 0. If 1, we only produce an \s-1XHTML\s0 fragment (suitable for use as a server-side include etc). There is no \s-1HEAD\s0 element nor any \s-1BODY\s0 or \s-1HTML\s0 tags. Any text added with the add*Text methods will not be output.

TopHeading

Allows you to set the starting heading level when in fragment mode. For example, if your document already has h1 tags and you want the generated \s-1POD\s0 to nest inside the outline, you can specify TopHeading => 2 and \*(C`=head1\*(C' will be tagged with h2 tags, \*(C`=head3\*(C' with h3, and so on. Note that \s-1XHTML\s0 doesn't allow for heading tags past h6, so h7 and up will be translated to h6 as necessary.

TopLinks

At each section head this text is added to provide a link back to the top. Set to 0 or '' to inhibit links, or define your own. Default: <p><a href="#TOP" class="toplink">Top</a></p>

LinkParser

An object that parses links in the \s-1POD\s0 document. By default, this is a regular Pod::Hyperlink object. Any user-supplied link parser must conform the the Pod::Hyperlink \s-1API\s0. This module works with a Pod::Hyperlink::BounceURL link parser and generates hyperlinks as 'a' elements with a class of 'pod_xhtml_bounce_url'. The optional text giving the \*(L"node\*(R" is enclosed in a 'strong' element with a class of 'pod_xhtml_bounce_url_text'

RATIONALE

There's Pod::PXML and Pod::XML, so why do we need Pod::Xhtml? You need an \s-1XSLT\s0 to transform \s-1XML\s0 into \s-1XHTML\s0 and many people don't have the time or inclination to do this. But they want to make sure that the pages they put on their web site are well-formed, they want those pages to use stylesheets easily, and possibly they want to squirt the \s-1XHTML\s0 through some kind of filter for more processing.

By generating well-formed \s-1XHTML\s0 straight away we allow anyone to just use the output files as-is. For those who want to use \s-1XML\s0 tools or transformations they can use the \s-1XHTML\s0 as a source, because it's a well-formed \s-1XML\s0 document.

CAVEATS

This module outputs well-formed \s-1XHTML\s0 if the \s-1POD\s0 is well-formed. To check this you can use something like:

use Pod::Checker; my $syn = podchecker($defaultIn);

If $syn is 0 there are no syntax errors. If it's -1 then no \s-1POD\s0 was found. Any positive number indicates that that number of errors were found. If the input \s-1POD\s0 has errors then the output \s-1XHTML\s0 should be well-formed but will probably omit information, and in addition Pod::Xhtml will emit warnings. Note that Pod::Parser seems to be sensitive to the current setting of $/ so ensure it's the end-of-line character when the parsing is done.

AUTHOR

P Kent & Simon Flack <cpan _at_ bbc _dot_ co _dot_ uk>

COPYRIGHT

(c) \s-1BBC\s0 2004, 2005. This program is free software; you can redistribute it and/or modify it under the \s-1GNU\s0 \s-1GPL\s0.

See the file \s-1COPYING\s0 in this distribution, or http://www.gnu.org/licenses/gpl.txt