{
    "mode": "perldoc",
    "parameter": "Pod::Simple::XHTML",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Pod%3A%3ASimple%3A%3AXHTML/json",
    "generated": "2026-06-13T00:16:31Z",
    "synopsis": "use Pod::Simple::XHTML;\nmy $parser = Pod::Simple::XHTML->new();\n...\n$parser->parsefile('path/to/file.pod');",
    "sections": {
        "NAME": {
            "content": "Pod::Simple::XHTML -- format Pod as validating XHTML\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Pod::Simple::XHTML;\n\nmy $parser = Pod::Simple::XHTML->new();\n\n...\n\n$parser->parsefile('path/to/file.pod');\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This class is a formatter that takes Pod and renders it as XHTML validating HTML.\n\nThis is a subclass of Pod::Simple::Methody and inherits all its methods. The implementation is\nentirely different than Pod::Simple::HTML, but it largely preserves the same interface.\n",
            "subsections": [
                {
                    "name": "Minimal code",
                    "content": "use Pod::Simple::XHTML;\nmy $psx = Pod::Simple::XHTML->new;\n$psx->outputstring(\\my $html);\n$psx->parsefile('path/to/Module/Name.pm');\nopen my $out, '>', 'out.html' or die \"Cannot open 'out.html': $!\\n\";\nprint $out $html;\n\nYou can also control the character encoding and entities. For example, if you're sure that the\nPOD is properly encoded (using the \"=encoding\" command), you can prevent high-bit characters\nfrom being encoded as HTML entities and declare the output character set as UTF-8 before\nparsing, like so:\n\n$psx->htmlcharset('UTF-8');\n$psx->htmlencodechars(q{&<>'\"});\n"
                }
            ]
        },
        "METHODS": {
            "content": "Pod::Simple::XHTML offers a number of methods that modify the format of the HTML output. Call\nthese after creating the parser object, but before the call to \"parsefile\":\n\nmy $parser = Pod::PseudoPod::HTML->new();\n$parser->setoptionalparam(\"value\");\n$parser->parsefile($file);\n\nperldocurlprefix\nIn turning Foo::Bar into http://whatever/Foo%3a%3aBar, what to put before the \"Foo%3a%3aBar\".\nThe default value is \"https://metacpan.org/pod/\".\n\nperldocurlpostfix\nWhat to put after \"Foo%3a%3aBar\" in the URL. This option is not set by default.\n\nmanurlprefix\nIn turning crontab(5) into http://whatever/man/1/crontab, what to put before the \"1/crontab\".\nThe default value is \"http://man.he.net/man\".\n\nmanurlpostfix\nWhat to put after \"1/crontab\" in the URL. This option is not set by default.\n\ntitleprefix, titlepostfix\nWhat to put before and after the title in the head. The values should already be &-escaped.\n\nhtmlcss\n$parser->htmlcss('path/to/style.css');\n\nThe URL or relative path of a CSS file to include. This option is not set by default.\n\nhtmljavascript\nThe URL or relative path of a JavaScript file to pull in. This option is not set by default.\n\nhtmldoctype\nA document type tag for the file. This option is not set by default.\n\nhtmlcharset\nThe character set to declare in the Content-Type meta tag created by default for\n\"htmlheadertags\". Note that this option will be ignored if the value of \"htmlheadertags\" is\nchanged. Defaults to \"ISO-8859-1\".\n\nhtmlheadertags\nAdditional arbitrary HTML tags for the header of the document. The default value is just a\ncontent type header tag:\n\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n\nAdd additional meta tags here, or blocks of inline CSS or JavaScript (wrapped in the appropriate\ntags).\n\nhtmlencodechars\nA string containing all characters that should be encoded as HTML entities, specified using the\nregular expression character class syntax (what you find within brackets in regular\nexpressions). This value will be passed as the second argument to the \"encodeentities\" function\nof HTML::Entities. If HTML::Entities is not installed, then any characters other than \"&<\"\"'>\nwill be encoded numerically.\n\nhtmlhlevel\nThis is the level of HTML \"Hn\" element to which a Pod \"head1\" corresponds. For example, if\n\"htmlhlevel\" is set to 2, a head1 will produce an H2, a head2 will produce an H3, and so on.\n\ndefaulttitle\nSet a default title for the page if no title can be determined from the content. The value of\nthis string should already be &-escaped.\n\nforcetitle\nForce a title for the page (don't try to determine it from the content). The value of this\nstring should already be &-escaped.\n\nhtmlheader, htmlfooter\nSet the HTML output at the beginning and end of each file. The default header includes a title,\na doctype tag (if \"htmldoctype\" is set), a content tag (customized by \"htmlheadertags\"), a\ntag for a CSS file (if \"htmlcss\" is set), and a tag for a Javascript file (if \"htmljavascript\"\nis set). The default footer simply closes the \"html\" and \"body\" tags.\n\nThe options listed above customize parts of the default header, but setting \"htmlheader\" or\n\"htmlfooter\" completely overrides the built-in header or footer. These may be useful if you\nwant to use template tags instead of literal HTML headers and footers or are integrating\nconverted POD pages in a larger website.\n\nIf you want no headers or footers output in the HTML, set these options to the empty string.\n\nindex\nWhether to add a table-of-contents at the top of each page (called an index for the sake of\ntradition).\n\nanchoritems\nWhether to anchor every definition \"=item\" directive. This needs to be enabled if you want to be\nable to link to specific \"=item\" directives, which are output as \"<dt>\" elements. Disabled by\ndefault.\n\nbacklink\nWhether to turn every =head1 directive into a link pointing to the top of the page\n(specifically, the opening body tag).\n",
            "subsections": []
        },
        "SUBCLASSING": {
            "content": "If the standard options aren't enough, you may want to subclass Pod::Simple::XHMTL. These are\nthe most likely candidates for methods you'll want to override when subclassing.\n\nhandletext\nThis method handles the body of text within any element: it's the body of a paragraph, or\neverything between a \"=begin\" tag and the corresponding \"=end\" tag, or the text within an L\nentity, etc. You would want to override this if you are adding a custom element type that does\nmore than just display formatted text. Perhaps adding a way to generate HTML tables from an\nextended version of POD.\n\nSo, let's say you want to add a custom element called 'foo'. In your subclass's \"new\" method,\nafter calling \"SUPER::new\" you'd call:\n\n$new->accepttargetsastext( 'foo' );\n\nThen override the \"startfor\" method in the subclass to check for when \"$flags->{'target'}\" is\nequal to 'foo' and set a flag that marks that you're in a foo block (maybe \"$self->{'infoo'} =\n1\"). Then override the \"handletext\" method to check for the flag, and pass $text to your custom\nsubroutine to construct the HTML output for 'foo' elements, something like:\n\nsub handletext {\nmy ($self, $text) = @;\nif ($self->{'infoo'}) {\n$self->{'scratch'} .= buildfoohtml($text);\nreturn;\n}\n$self->SUPER::handletext($text);\n}\n\nhandlecode\nThis method handles the body of text that is marked up to be code. You might for instance\noverride this to plug in a syntax highlighter. The base implementation just escapes the text.\n\nThe callback methods \"startcode\" and \"endcode\" emits the \"code\" tags before and after\n\"handlecode\" is invoked, so you might want to override these together with \"handlecode\" if\nthis wrapping isn't suitable.\n\nNote that the code might be broken into multiple segments if there are nested formatting codes\ninside a \"C<...>\" sequence. In between the calls to \"handlecode\" other markup tags might have\nbeen emitted in that case. The same is true for verbatim sections if the \"codesinverbatim\"\noption is turned on.\n\naccepttargetsashtml\nThis method behaves like \"accepttargetsastext\", but also marks the region as one whose\ncontent should be emitted literally, without HTML entity escaping or wrapping in a \"div\"\nelement.\n\nresolvepodpagelink\nmy $url = $pod->resolvepodpagelink('Net::Ping', 'INSTALL');\nmy $url = $pod->resolvepodpagelink('perlpodspec');\nmy $url = $pod->resolvepodpagelink(undef, 'SYNOPSIS');\n\nResolves a POD link target (typically a module or POD file name) and section name to a URL. The\nresulting link will be returned for the above examples as:\n\nhttps://metacpan.org/pod/Net::Ping#INSTALL\nhttps://metacpan.org/pod/perlpodspec\n#SYNOPSIS\n\nNote that when there is only a section argument the URL will simply be a link to a section in\nthe current document.\n\nresolvemanpagelink\nmy $url = $pod->resolvemanpagelink('crontab(5)', 'EXAMPLE CRON FILE');\nmy $url = $pod->resolvemanpagelink('crontab');\n\nResolves a man page link target and numeric section to a URL. The resulting link will be\nreturned for the above examples as:\n\nhttp://man.he.net/man5/crontab\nhttp://man.he.net/man1/crontab\n\nNote that the first argument is required. The section number will be parsed from it, and if it's\nmissing will default to 1. The second argument is currently ignored, as man.he.net\n<http://man.he.net> does not currently include linkable IDs or anchor names in its pages.\nSubclass to link to a different man page HTTP server.\n\nidify\nmy $id   = $pod->idify($text);\nmy $hash = $pod->idify($text, 1);\n\nThis method turns an arbitrary string into a valid XHTML ID attribute value. The rules enforced,\nfollowing <http://webdesign.about.com/od/htmltags/a/aa031707.htm>, are:\n\n*   The id must start with a letter (a-z or A-Z)\n\n*   All subsequent characters can be letters, numbers (0-9), hyphens (-), underscores (),\ncolons (:), and periods (.).\n\n*   The final character can't be a hyphen, colon, or period. URLs ending with these characters,\nwhile allowed by XHTML, can be awkward to extract from plain text.\n\n*   Each id must be unique within the document.\n\nIn addition, the returned value will be unique within the context of the Pod::Simple::XHTML\nobject unless a second argument is passed a true value. ID attributes should always be unique\nwithin a single XHTML document, but pass the true value if you are creating not an ID but a URL\nhash to point to an ID (i.e., if you need to put the \"#foo\" in \"<a href=\"#foo\">foo</a>\".\n\nbatchmodepageobjectinit\n$pod->batchmodepageobjectinit($batchconvobj, $module, $infile, $outfile, $depth);\n\nCalled by Pod::Simple::HTMLBatch so that the class has a chance to initialize the converter.\nInternally it sets the \"batchmode\" property to true and sets \"batchmodecurrentlevel()\", but\nPod::Simple::XHTML does not currently use those features. Subclasses might, though.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Pod::Simple, Pod::Simple::Text, Pod::Spell\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail\nlist. Send an empty email to pod-people-subscribe@perl.org to subscribe.\n\nThis module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>.\nFeel free to fork and contribute, or to clone <git://github.com/perl-pod/pod-simple.git> and\nsend patches!\n\nPatches against Pod::Simple are welcome. Please send bug reports to\n<bug-pod-simple@rt.cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT AND DISCLAIMERS": {
            "content": "Copyright (c) 2003-2005 Allison Randal.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nThis program is distributed in the hope that it will be useful, but without any warranty;\nwithout even the implied warranty of merchantability or fitness for a particular purpose.\n",
            "subsections": []
        },
        "ACKNOWLEDGEMENTS": {
            "content": "Thanks to Hurricane Electric <http://he.net/> for permission to use its Linux man pages online\n<http://man.he.net/> site for man page links.\n\nThanks to search.cpan.org <http://search.cpan.org/> for permission to use the site for Perl\nmodule links.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Pod::Simpele::XHTML was created by Allison Randal <allison@perl.org>.\n\nPod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't bother him, he's retired.\n\nPod::Simple is maintained by:\n\n*   Allison Randal \"allison@perl.org\"\n\n*   Hans Dieter Pearcey \"hdp@cpan.org\"\n\n*   David E. Wheeler \"dwheeler@cpan.org\"\n",
            "subsections": []
        }
    },
    "summary": "Pod::Simple::XHTML -- format Pod as validating XHTML",
    "flags": [],
    "examples": [],
    "see_also": []
}