CINXE.COM
Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass - Perldoc Browser
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/Pod::Simple::Subclassing"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.10.1</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/Pod::Simple::Subclassing">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/Pod::Simple::Subclassing">5.40.1</a> <a class="dropdown-item" href="/5.40.0/Pod::Simple::Subclassing">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/Pod::Simple::Subclassing">5.38.3</a> <a class="dropdown-item" href="/5.38.2/Pod::Simple::Subclassing">5.38.2</a> <a class="dropdown-item" href="/5.38.1/Pod::Simple::Subclassing">5.38.1</a> <a class="dropdown-item" href="/5.38.0/Pod::Simple::Subclassing">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/Pod::Simple::Subclassing">5.36.3</a> <a class="dropdown-item" href="/5.36.2/Pod::Simple::Subclassing">5.36.2</a> <a class="dropdown-item" href="/5.36.1/Pod::Simple::Subclassing">5.36.1</a> <a class="dropdown-item" href="/5.36.0/Pod::Simple::Subclassing">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/Pod::Simple::Subclassing">5.34.3</a> <a class="dropdown-item" href="/5.34.2/Pod::Simple::Subclassing">5.34.2</a> <a class="dropdown-item" href="/5.34.1/Pod::Simple::Subclassing">5.34.1</a> <a class="dropdown-item" href="/5.34.0/Pod::Simple::Subclassing">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/Pod::Simple::Subclassing">5.32.1</a> <a class="dropdown-item" href="/5.32.0/Pod::Simple::Subclassing">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/Pod::Simple::Subclassing">5.30.3</a> <a class="dropdown-item" href="/5.30.2/Pod::Simple::Subclassing">5.30.2</a> <a class="dropdown-item" href="/5.30.1/Pod::Simple::Subclassing">5.30.1</a> <a class="dropdown-item" href="/5.30.0/Pod::Simple::Subclassing">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/Pod::Simple::Subclassing">5.28.3</a> <a class="dropdown-item" href="/5.28.2/Pod::Simple::Subclassing">5.28.2</a> <a class="dropdown-item" href="/5.28.1/Pod::Simple::Subclassing">5.28.1</a> <a class="dropdown-item" href="/5.28.0/Pod::Simple::Subclassing">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/Pod::Simple::Subclassing">5.26.3</a> <a class="dropdown-item" href="/5.26.2/Pod::Simple::Subclassing">5.26.2</a> <a class="dropdown-item" href="/5.26.1/Pod::Simple::Subclassing">5.26.1</a> <a class="dropdown-item" href="/5.26.0/Pod::Simple::Subclassing">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/Pod::Simple::Subclassing">5.24.4</a> <a class="dropdown-item" href="/5.24.3/Pod::Simple::Subclassing">5.24.3</a> <a class="dropdown-item" href="/5.24.2/Pod::Simple::Subclassing">5.24.2</a> <a class="dropdown-item" href="/5.24.1/Pod::Simple::Subclassing">5.24.1</a> <a class="dropdown-item" href="/5.24.0/Pod::Simple::Subclassing">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/Pod::Simple::Subclassing">5.22.4</a> <a class="dropdown-item" href="/5.22.3/Pod::Simple::Subclassing">5.22.3</a> <a class="dropdown-item" href="/5.22.2/Pod::Simple::Subclassing">5.22.2</a> <a class="dropdown-item" href="/5.22.1/Pod::Simple::Subclassing">5.22.1</a> <a class="dropdown-item" href="/5.22.0/Pod::Simple::Subclassing">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/Pod::Simple::Subclassing">5.20.3</a> <a class="dropdown-item" href="/5.20.2/Pod::Simple::Subclassing">5.20.2</a> <a class="dropdown-item" href="/5.20.1/Pod::Simple::Subclassing">5.20.1</a> <a class="dropdown-item" href="/5.20.0/Pod::Simple::Subclassing">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/Pod::Simple::Subclassing">5.18.4</a> <a class="dropdown-item" href="/5.18.3/Pod::Simple::Subclassing">5.18.3</a> <a class="dropdown-item" href="/5.18.2/Pod::Simple::Subclassing">5.18.2</a> <a class="dropdown-item" href="/5.18.1/Pod::Simple::Subclassing">5.18.1</a> <a class="dropdown-item" href="/5.18.0/Pod::Simple::Subclassing">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/Pod::Simple::Subclassing">5.16.3</a> <a class="dropdown-item" href="/5.16.2/Pod::Simple::Subclassing">5.16.2</a> <a class="dropdown-item" href="/5.16.1/Pod::Simple::Subclassing">5.16.1</a> <a class="dropdown-item" href="/5.16.0/Pod::Simple::Subclassing">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/Pod::Simple::Subclassing">5.14.4</a> <a class="dropdown-item" href="/5.14.3/Pod::Simple::Subclassing">5.14.3</a> <a class="dropdown-item" href="/5.14.2/Pod::Simple::Subclassing">5.14.2</a> <a class="dropdown-item" href="/5.14.1/Pod::Simple::Subclassing">5.14.1</a> <a class="dropdown-item" href="/5.14.0/Pod::Simple::Subclassing">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/Pod::Simple::Subclassing">5.12.5</a> <a class="dropdown-item" href="/5.12.4/Pod::Simple::Subclassing">5.12.4</a> <a class="dropdown-item" href="/5.12.3/Pod::Simple::Subclassing">5.12.3</a> <a class="dropdown-item" href="/5.12.2/Pod::Simple::Subclassing">5.12.2</a> <a class="dropdown-item" href="/5.12.1/Pod::Simple::Subclassing">5.12.1</a> <a class="dropdown-item" href="/5.12.0/Pod::Simple::Subclassing">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item active" href="/5.10.1/Pod::Simple::Subclassing">5.10.1</a> <a class="dropdown-item" href="/5.10.0/Pod::Simple::Subclassing">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/Pod::Simple::Subclassing">5.8.9</a> <a class="dropdown-item" href="/5.8.8/Pod::Simple::Subclassing">5.8.8</a> <a class="dropdown-item" href="/5.8.7/Pod::Simple::Subclassing">5.8.7</a> <a class="dropdown-item" href="/5.8.6/Pod::Simple::Subclassing">5.8.6</a> <a class="dropdown-item" href="/5.8.5/Pod::Simple::Subclassing">5.8.5</a> <a class="dropdown-item" href="/5.8.4/Pod::Simple::Subclassing">5.8.4</a> <a class="dropdown-item" href="/5.8.3/Pod::Simple::Subclassing">5.8.3</a> <a class="dropdown-item" href="/5.8.2/Pod::Simple::Subclassing">5.8.2</a> <a class="dropdown-item" href="/5.8.1/Pod::Simple::Subclassing">5.8.1</a> <a class="dropdown-item" href="/5.8.0/Pod::Simple::Subclassing">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/Pod::Simple::Subclassing">5.6.2</a> <a class="dropdown-item" href="/5.6.1/Pod::Simple::Subclassing">5.6.1</a> <a class="dropdown-item" href="/5.6.0/Pod::Simple::Subclassing">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/Pod::Simple::Subclassing">5.005_04</a> <a class="dropdown-item" href="/5.005_03/Pod::Simple::Subclassing">5.005_03</a> <a class="dropdown-item" href="/5.005_02/Pod::Simple::Subclassing">5.005_02</a> <a class="dropdown-item" href="/5.005_01/Pod::Simple::Subclassing">5.005_01</a> <a class="dropdown-item" href="/5.005/Pod::Simple::Subclassing">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/Pod::Simple::Subclassing">blead</a> <a class="dropdown-item" href="/5.41.10/Pod::Simple::Subclassing">5.41.10</a> <a class="dropdown-item" href="/5.41.9/Pod::Simple::Subclassing">5.41.9</a> <a class="dropdown-item" href="/5.41.8/Pod::Simple::Subclassing">5.41.8</a> <a class="dropdown-item" href="/5.41.7/Pod::Simple::Subclassing">5.41.7</a> <a class="dropdown-item" href="/5.41.6/Pod::Simple::Subclassing">5.41.6</a> <a class="dropdown-item" href="/5.41.5/Pod::Simple::Subclassing">5.41.5</a> <a class="dropdown-item" href="/5.41.4/Pod::Simple::Subclassing">5.41.4</a> <a class="dropdown-item" href="/5.41.3/Pod::Simple::Subclassing">5.41.3</a> <a class="dropdown-item" href="/5.41.2/Pod::Simple::Subclassing">5.41.2</a> <a class="dropdown-item" href="/5.41.1/Pod::Simple::Subclassing">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/Pod::Simple::Subclassing">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/Pod::Simple::Subclassing">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/Pod::Simple::Subclassing">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/Pod::Simple::Subclassing">5.39.10</a> <a class="dropdown-item" href="/5.39.9/Pod::Simple::Subclassing">5.39.9</a> <a class="dropdown-item" href="/5.39.8/Pod::Simple::Subclassing">5.39.8</a> <a class="dropdown-item" href="/5.39.7/Pod::Simple::Subclassing">5.39.7</a> <a class="dropdown-item" href="/5.39.6/Pod::Simple::Subclassing">5.39.6</a> <a class="dropdown-item" href="/5.39.5/Pod::Simple::Subclassing">5.39.5</a> <a class="dropdown-item" href="/5.39.4/Pod::Simple::Subclassing">5.39.4</a> <a class="dropdown-item" href="/5.39.3/Pod::Simple::Subclassing">5.39.3</a> <a class="dropdown-item" href="/5.39.2/Pod::Simple::Subclassing">5.39.2</a> <a class="dropdown-item" href="/5.39.1/Pod::Simple::Subclassing">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/Pod::Simple::Subclassing">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.10.1/perl">Perl</a> <a class="dropdown-item" href="/5.10.1/perlintro">Intro</a> <a class="dropdown-item" href="/5.10.1/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.10.1/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.10.1/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perlop">Operators</a> <a class="dropdown-item" href="/5.10.1/functions">Functions</a> <a class="dropdown-item" href="/5.10.1/variables">Variables</a> <a class="dropdown-item" href="/5.10.1/modules">Modules</a> <a class="dropdown-item" href="/5.10.1/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.10.1/perlcommunity">Community</a> <a class="dropdown-item" href="/5.10.1/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.10.1/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.10.1/Pod::Simple::Subclassing">Pod::Simple::Subclassing</a> <div id="more"> (<a href="/5.10.1/Pod::Simple::Subclassing.txt">source</a>, <a href="https://metacpan.org/pod/Pod::Simple::Subclassing">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.10.1. <a href="/Pod::Simple::Subclassing">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> </li> <li> <a class="text-decoration-none" href="#Events">Events</a> </li> <li> <a class="text-decoration-none" href="#More-Pod::Simple-Methods">More Pod::Simple Methods</a> </li> <li> <a class="text-decoration-none" href="#SEE-ALSO">SEE ALSO</a> </li> <li> <a class="text-decoration-none" href="#COPYRIGHT-AND-DISCLAIMERS">COPYRIGHT AND DISCLAIMERS</a> </li> <li> <a class="text-decoration-none" href="#AUTHOR">AUTHOR</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code>package Pod::SomeFormatter; use Pod::Simple; @ISA = qw(Pod::Simple); $VERSION = '1.01'; use strict; sub _handle_element_start { my($parser, $element_name, $attr_hash_r) = @_; ... } sub _handle_element_end { my($parser, $element_name) = @_; ... } sub _handle_text { my($parser, $text) = @_; ... } 1;</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>This document is about using Pod::Simple to write a Pod processor, generally a Pod formatter. If you just want to know about using an existing Pod formatter, instead see its documentation and see also the docs in <a href="/5.10.1/Pod::Simple">Pod::Simple</a>.</p> <p>The zeroeth step in writing a Pod formatter is to make sure that there isn't already a decent one in CPAN. See <a href="http://search.cpan.org/">http://search.cpan.org/</a>, and run a search on the name of the format you want to render to. Also consider joining the Pod People list <a href="http://lists.perl.org/showlist.cgi?name=pod-people">http://lists.perl.org/showlist.cgi?name=pod-people</a> and asking whether anyone has a formatter for that format -- maybe someone cobbled one together but just hasn't released it.</p> <p>The first step in writing a Pod processor is to read <a href="/5.10.1/perlpodspec">perlpodspec</a>, which contains notes information on writing a Pod parser (which has been largely taken care of by Pod::Simple), but also a lot of requirements and recommendations for writing a formatter.</p> <p>The second step is to actually learn the format you're planning to format to -- or at least as much as you need to know to represent Pod, which probably isn't much.</p> <p>The third step is to pick which of Pod::Simple's interfaces you want to use -- the basic interface via Pod::Simple or <a href="/5.10.1/Pod::Simple::Methody">Pod::Simple::Methody</a> is event-based, sort of like <a href="/5.10.1/HTML::Parser">HTML::Parser</a>'s interface, or sort of like <a href="/5.10.1/XML::Parser">XML::Parser</a>'s "Handlers" interface), but <a href="/5.10.1/Pod::Simple::PullParser">Pod::Simple::PullParser</a> provides a token-stream interface, sort of like <a href="/5.10.1/HTML::TokeParser">HTML::TokeParser</a>'s interface; <a href="/5.10.1/Pod::Simple::SimpleTree">Pod::Simple::SimpleTree</a> provides a simple tree interface, rather like XML::Parser's "Tree" interface. Users familiar with XML-handling will find one of these styles relatively familiar; but if you would be even more at home with XML, there are classes that produce an XML representation of the Pod stream, notably <a href="/5.10.1/Pod::Simple::XMLOutStream">Pod::Simple::XMLOutStream</a>; you can feed the output of such a class to whatever XML parsing system you are most at home with.</p> <p>The last step is to write your code based on how the events (or tokens, or tree-nodes, or the XML, or however you're parsing) will map to constructs in the output format. Also sure to consider how to escape text nodes containing arbitrary text, and also what to do with text nodes that represent preformatted text (from verbatim sections).</p> <h1 id="Events"><a class="permalink" href="#Events">#</a>Events</h1> <p>TODO intro... mention that events are supplied for implicits, like for missing >'s</p> <p>In the following section, we use XML to represent the event structure associated with a particular construct. That is, TODO</p> <dl> <dt id="$parser->_handle_element_start(-element_name,-attr_hashref-)"><a class="permalink" href="#$parser-%3E_handle_element_start(-element_name,-attr_hashref-)">#</a><a id="_handle_element_start"></a><a id="parser-_handle_element_start-element_name-attr_hashref"></a><code>$parser->_handle_element_start( <i>element_name</i>, <i>attr_hashref</i> )</code></dt> <dd> </dd> <dt id="$parser->_handle_element_end(-element_name-)"><a class="permalink" href="#$parser-%3E_handle_element_end(-element_name-)">#</a><a id="_handle_element_end"></a><a id="parser-_handle_element_end-element_name"></a><code>$parser->_handle_element_end( <i>element_name</i> )</code></dt> <dd> </dd> <dt id="$parser->_handle_text(-text_string-)"><a class="permalink" href="#$parser-%3E_handle_text(-text_string-)">#</a><a id="_handle_text"></a><a id="parser-_handle_text-text_string"></a><code>$parser->_handle_text( <i>text_string</i> )</code></dt> <dd> </dd> </dl> <p>TODO describe</p> <dl> <dt id="events-with-an-element_name-of-Document"><a class="permalink" href="#events-with-an-element_name-of-Document">#</a><a id="events"></a>events with an element_name of Document</dt> <dd> <p>Parsing a document produces this event structure:</p> <pre><code class="plaintext"><Document start_line="543"> ...all events... </Document></code></pre> <p>The value of the <i>start_line</i> attribute will be the line number of the first Pod directive in the document.</p> <p>If there is no Pod in the given document, then the event structure will be this:</p> <pre><code class="plaintext"><Document contentless="1" start_line="543"> </Document></code></pre> <p>In that case, the value of the <i>start_line</i> attribute will not be meaningful; under current implementations, it will probably be the line number of the last line in the file.</p> </dd> <dt id="events-with-an-element_name-of-Para"><a class="permalink" href="#events-with-an-element_name-of-Para">#</a><a id="events1"></a>events with an element_name of Para</dt> <dd> <p>Parsing a plain (non-verbatim, non-directive, non-data) paragraph in a Pod document produces this event structure:</p> <pre><code class="plaintext"><Para start_line="543"> ...all events in this paragraph... </Para></code></pre> <p>The value of the <i>start_line</i> attribute will be the line number of the start of the paragraph.</p> <p>For example, parsing this paragraph of Pod:</p> <pre><code class="plaintext">The value of the I<start_line> attribute will be the line number of the start of the paragraph.</code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><Para start_line="129"> The value of the <I> start_line </I> attribute will be the line number of the first Pod directive in the document. </Para></code></pre> </dd> <dt id="events-with-an-element_name-of-B,-C,-F,-or-I."><a class="permalink" href="#events-with-an-element_name-of-B,-C,-F,-or-I.">#</a><a id="events2"></a><a id="events-with-an-element_name-of-B-C-F-or-I"></a>events with an element_name of B, C, F, or I.</dt> <dd> <p>Parsing a B<...> formatting code (or of course any of its semantically identical syntactic variants <span style="white-space: nowrap;">B<< ... >></span>, or <span style="white-space: nowrap;">B<<<< ... >>>></span>, etc.) produces this event structure:</p> <pre><code class="plaintext"><B> ...stuff... </B></code></pre> <p>Currently, there are no attributes conveyed.</p> <p>Parsing C, F, or I codes produce the same structure, with only a different element name.</p> <p>If your parser object has been set to accept other formatting codes, then they will be presented like these B/C/F/I codes -- i.e., without any attributes.</p> </dd> <dt id="events-with-an-element_name-of-S"><a class="permalink" href="#events-with-an-element_name-of-S">#</a><a id="events3"></a>events with an element_name of S</dt> <dd> <p>Normally, parsing an S<...> sequence produces this event structure, just as if it were a B/C/F/I code:</p> <pre><code class="plaintext"><S> ...stuff... </S></code></pre> <p>However, Pod::Simple (and presumably all derived parsers) offers the <code>nbsp_for_S</code> option which, if enabled, will suppress all S events, and instead change all spaces in the content to non-breaking spaces. This is intended for formatters that output to a format that has no code that means the same as S<...>, but which has a code/character that means non-breaking space.</p> </dd> <dt id="events-with-an-element_name-of-X"><a class="permalink" href="#events-with-an-element_name-of-X">#</a><a id="events4"></a>events with an element_name of X</dt> <dd> <p>Normally, parsing an X<...> sequence produces this event structure, just as if it were a B/C/F/I code:</p> <pre><code class="plaintext"><X> ...stuff... </X></code></pre> <p>However, Pod::Simple (and presumably all derived parsers) offers the <code>nix_X_codes</code> option which, if enabled, will suppress all X events and ignore their content. For formatters/processors that don't use X events, this is presumably quite useful.</p> </dd> <dt id="events-with-an-element_name-of-L"><a class="permalink" href="#events-with-an-element_name-of-L">#</a><a id="events5"></a>events with an element_name of L</dt> <dd> <p>Because the L<...> is the most complex construct in the language, it should not surprise you that the events it generates are the most complex in the language. Most of complexity is hidden away in the attribute values, so for those of you writing a Pod formatter that produces a non-hypertextual format, you can just ignore the attributes and treat an L event structure like a formatting element that (presumably) doesn't actually produce a change in formatting. That is, the content of the L event structure (as opposed to its attributes) is always what text should be displayed.</p> <p>There are, at first glance, three kinds of L links: URL, man, and pod.</p> <p>When a L<<i>some_url</i>> code is parsed, it produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="that_url" type="url"> that_url </L></code></pre> <p>The <code>type="url"</code> attribute is always specified for this type of L code.</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">L<http://www.perl.com/CPAN/authors/></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="http://www.perl.com/CPAN/authors/" type="url"> http://www.perl.com/CPAN/authors/ </L></code></pre> <p>When a L<<i>manpage(section)</i>> code is parsed (and these are fairly rare and not terribly useful), it produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="manpage(section)" type="man"> manpage(section) </L></code></pre> <p>The <code>type="man"</code> attribute is always specified for this type of L code.</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">L<crontab(5)></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="crontab(5)" type="man"> crontab(5) </L></code></pre> <p>In the rare cases where a man page link has a specified, that text appears in a <i>section</i> attribute. For example, this Pod source:</p> <pre><code class="plaintext">L<crontab(5)/"ENVIRONMENT"></code></pre> <p>will produce this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" section="ENVIRONMENT" to="crontab(5)" type="man"> "ENVIRONMENT" in crontab(5) </L></code></pre> <p>In the rare case where the Pod document has code like L<<i>sometext</i>|<i>manpage(section)</i>>, then the <i>sometext</i> will appear as the content of the element, the <i>manpage(section)</i> text will appear only as the value of the <i>to</i> attribute, and there will be no <code>content-implicit="yes"</code> attribute (whose presence means that the Pod parser had to infer what text should appear as the link text -- as opposed to cases where that attribute is absent, which means that the Pod parser did <i>not</i> have to infer the link text, because that L code explicitly specified some link text.)</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">L<hell itself!|crontab(5)></code></pre> <p>will produce this event structure:</p> <pre><code class="plaintext"><L to="crontab(5)" type="man"> hell itself! </L></code></pre> <p>The last type of L structure is for links to/within Pod documents. It is the most complex because it can have a <i>to</i> attribute, <i>or</i> a <i>section</i> attribute, or both. The <code>type="pod"</code> attribute is always specified for this type of L code.</p> <p>In the most common case, the simple case of a L<podpage> code produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="Net::Ping" type="pod"> podpage </L></code></pre> <p>For example, this Pod source:</p> <pre><code class="plaintext">L<Net::Ping></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" to="Net::Ping" type="pod"> Net::Ping </L></code></pre> <p>In cases where there is link-text explicitly specified, it is to be found in the content of the element (and not the attributes), just as with the L<<i>sometext</i>|<i>manpage(section)</i>> case discussed above. For example, this Pod source:</p> <pre><code class="plaintext">L<Perl Error Messages|perldiag></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L to="perldiag" type="pod"> Perl Error Messages </L></code></pre> <p>In cases of links to a section in the current Pod document, there is a <i>section</i> attribute instead of a <i>to</i> attribute. For example, this Pod source:</p> <pre><code class="plaintext">L</"Member Data"></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" section="Member Data" type="pod"> "Member Data" </L></code></pre> <p>As another example, this Pod source:</p> <pre><code class="plaintext">L<the various attributes|/"Member Data"></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L section="Member Data" type="pod"> the various attributes </L></code></pre> <p>In cases of links to a section in a different Pod document, there are both a <i>section</i> attribute and a <a href="/5.10.1/to">to</a> attribute. For example, this Pod source:</p> <pre><code class="plaintext">L<perlsyn/"Basic BLOCKs and Switch Statements"></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L content-implicit="yes" section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod"> "Basic BLOCKs and Switch Statements" in perlsyn </L></code></pre> <p>As another example, this Pod source:</p> <pre><code class="plaintext">L<SWITCH statements|perlsyn/"Basic BLOCKs and Switch Statements"></code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><L section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod"> SWITCH statements </L></code></pre> <p>Incidentally, note that we do not distinguish between these syntaxes:</p> <pre><code class="plaintext">L</"Member Data"> L<"Member Data"> L</Member Data> L<Member Data> [deprecated syntax]</code></pre> <p>That is, they all produce the same event structure, namely:</p> <pre><code><L content-implicit="yes" section="Member Data" type="pod"> &#34;Member Data&#34; </L></code></pre> </dd> <dt id="events-with-an-element_name-of-E-or-Z"><a class="permalink" href="#events-with-an-element_name-of-E-or-Z">#</a><a id="events6"></a>events with an element_name of E or Z</dt> <dd> <p>While there are Pod codes E<...> and Z<>, these <i>do not</i> produce any E or Z events -- that is, there are no such events as E or Z.</p> </dd> <dt id="events-with-an-element_name-of-Verbatim"><a class="permalink" href="#events-with-an-element_name-of-Verbatim">#</a><a id="events7"></a>events with an element_name of Verbatim</dt> <dd> <p>When a Pod verbatim paragraph (AKA "codeblock") is parsed, it produces this event structure:</p> <pre><code class="plaintext"><Verbatim start_line="543" xml:space="preserve"> ...text... </Verbatim></code></pre> <p>The value of the <i>start_line</i> attribute will be the line number of the first line of this verbatim block. The <i>xml:space</i> attribute is always present, and always has the value "preserve".</p> <p>The text content will have tabs already expanded.</p> </dd> <dt id="events-with-an-element_name-of-head1-..-head4"><a class="permalink" href="#events-with-an-element_name-of-head1-..-head4">#</a><a id="events8"></a>events with an element_name of head1 .. head4</dt> <dd> <p>When a "=head1 ..." directive is parsed, it produces this event structure:</p> <pre><code class="plaintext"><head1> ...stuff... </head1></code></pre> <p>For example, a directive consisting of this:</p> <pre><code class="plaintext">=head1 Options to C<new> et al.</code></pre> <p>will produce this event structure:</p> <pre><code class="plaintext"><head1 start_line="543"> Options to <C> new </C> et al. </head1></code></pre> <p>"=head2" thru "=head4" directives are the same, except for the element names in the event structure.</p> </dd> <dt id="events-with-an-element_name-of-over-bullet"><a class="permalink" href="#events-with-an-element_name-of-over-bullet">#</a><a id="events9"></a>events with an element_name of over-bullet</dt> <dd> <p>When an "=over ... =back" block is parsed where the items are a bulletted list, it will produce this event structure:</p> <pre><code class="plaintext"><over-bullet indent="4" start_line="543"> <item-bullet start_line="545"> ...Stuff... </item-bullet> ...more item-bullets... </over-bullet></code></pre> <p>The value of the <i>indent</i> attribute is whatever value is after the "=over" directive, as in "=over 8". If no such value is specified in the directive, then the <i>indent</i> attribute has the value "4".</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">=over =item * Stuff =item * Bar I<baz>! =back</code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><over-bullet indent="4" start_line="10"> <item-bullet start_line="12"> Stuff </item-bullet> <item-bullet start_line="14"> Bar <I>baz</I>! </item-bullet> </over-bullet></code></pre> </dd> <dt id="events-with-an-element_name-of-over-number"><a class="permalink" href="#events-with-an-element_name-of-over-number">#</a><a id="events10"></a>events with an element_name of over-number</dt> <dd> <p>When an "=over ... =back" block is parsed where the items are a numbered list, it will produce this event structure:</p> <pre><code class="plaintext"><over-number indent="4" start_line="543"> <item-number number="1" start_line="545"> ...Stuff... </item-number> ...more item-number... </over-bullet></code></pre> <p>This is like the "over-bullet" event structure; but note that the contents are "item-number" instead of "item-bullet", and note that they will have a "number" attribute, which some formatters/processors may ignore (since, for example, there's no need for it in HTML when producing an "<UL><LI>...</LI>...</UL>" structure), but which any processor may use.</p> <p>Note that the values for the <i>number</i> attributes of "item-number" elements in a given "over-number" area <i>will</i> start at 1 and go up by one each time. If the Pod source doesn't follow that order (even though it really should should!), whatever numbers it has will be ignored (with the correct values being put in the <i>number</i> attributes), and an error message might be issued to the user.</p> </dd> <dt id="events-with-an-element_name-of-over-text"><a class="permalink" href="#events-with-an-element_name-of-over-text">#</a><a id="events11"></a>events with an element_name of over-text</dt> <dd> <p>These events are are somewhat unlike the other over-* structures, as far as what their contents are. When an "=over ... =back" block is parsed where the items are a list of text "subheadings", it will produce this event structure:</p> <pre><code class="plaintext"><over-text indent="4" start_line="543"> <item-text> ...stuff... </item-text> ...stuff (generally Para or Verbatim elements)... <item-text> ...more item-text and/or stuff... </over-text></code></pre> <p>The <i>indent</i> attribute is as with the other over-* events.</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">=over =item Foo Stuff =item Bar I<baz>! Quux =back</code></pre> <p>produces this event structure:</p> <pre><code class="plaintext"><over-text indent="4" start_line="20"> <item-text start_line="22"> Foo </item-text> <Para start_line="24"> Stuff </Para> <item-text start_line="26"> Bar <I> baz </I> ! </item-text> <Para start_line="28"> Quux </Para> </over-text></code></pre> </dd> <dt id="events-with-an-element_name-of-over-block"><a class="permalink" href="#events-with-an-element_name-of-over-block">#</a><a id="events12"></a>events with an element_name of over-block</dt> <dd> <p>These events are are somewhat unlike the other over-* structures, as far as what their contents are. When an "=over ... =back" block is parsed where there are no items, it will produce this event structure:</p> <pre><code class="plaintext"><over-block indent="4" start_line="543"> ...stuff (generally Para or Verbatim elements)... </over-block></code></pre> <p>The <i>indent</i> attribute is as with the other over-* events.</p> <p>For example, this Pod source:</p> <pre><code class="plaintext">=over For cutting off our trade with all parts of the world For transporting us beyond seas to be tried for pretended offenses He is at this time transporting large armies of foreign mercenaries to complete the works of death, desolation and tyranny, already begun with circumstances of cruelty and perfidy scarcely paralleled in the most barbarous ages, and totally unworthy the head of a civilized nation. =cut</code></pre> <p>will produce this event structure:</p> <pre><code class="plaintext"><over-block indent="4" start_line="2"> <Para start_line="4"> For cutting off our trade with all parts of the world </Para> <Para start_line="6"> For transporting us beyond seas to be tried for pretended offenses </Para> <Para start_line="8"> He is at this time transporting large armies of [...more text...] </Para> </over-block></code></pre> </dd> <dt id="events-with-an-element_name-of-item-bullet"><a class="permalink" href="#events-with-an-element_name-of-item-bullet">#</a><a id="events13"></a>events with an element_name of item-bullet</dt> <dd> <p>See <a href="#events-with-an-element_name-of-over-bullet">"events with an element_name of over-bullet"</a>, above.</p> </dd> <dt id="events-with-an-element_name-of-item-number"><a class="permalink" href="#events-with-an-element_name-of-item-number">#</a><a id="events14"></a>events with an element_name of item-number</dt> <dd> <p>See <a href="#events-with-an-element_name-of-over-number">"events with an element_name of over-number"</a>, above.</p> </dd> <dt id="events-with-an-element_name-of-item-text"><a class="permalink" href="#events-with-an-element_name-of-item-text">#</a><a id="events15"></a>events with an element_name of item-text</dt> <dd> <p>See <a href="#events-with-an-element_name-of-over-text">"events with an element_name of over-text"</a>, above.</p> </dd> <dt id="events-with-an-element_name-of-for"><a class="permalink" href="#events-with-an-element_name-of-for">#</a><a id="events16"></a>events with an element_name of for</dt> <dd> <p>TODO...</p> </dd> <dt id="events-with-an-element_name-of-Data"><a class="permalink" href="#events-with-an-element_name-of-Data">#</a><a id="events17"></a>events with an element_name of Data</dt> <dd> <p>TODO...</p> </dd> </dl> <h1 id="More-Pod::Simple-Methods"><a class="permalink" href="#More-Pod::Simple-Methods">#</a><a id="More"></a>More Pod::Simple Methods</h1> <p>Pod::Simple provides a lot of methods that aren't generally interesting to the end user of an existing Pod formatter, but some of which you might find useful in writing a Pod formatter. They are listed below. The first several methods (the accept_* methods) are for declaring the capabilites of your parser, notably what <code>=for <i>targetname</i></code> sections it's interested in, what extra N<...> codes it accepts beyond the ones described in the <i>perlpod</i>.</p> <dl> <dt id="$parser->accept_targets(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Eaccept_targets(-SOMEVALUE-)">#</a><a id="accept_targets"></a><a id="parser-accept_targets-SOMEVALUE"></a><code>$parser->accept_targets( <i>SOMEVALUE</i> )</code></dt> <dd> <p>As the parser sees sections like:</p> <pre><code class="plaintext">=for html <img src="fig1.jpg"></code></pre> <p>or</p> <pre><code class="plaintext">=begin html <img src="fig1.jpg"> =end html</code></pre> <p>...the parser will ignore these sections unless your subclass has specified that it wants to see sections targetted to "html" (or whatever the formatter name is).</p> <p>If you want to process all sections, even if they're not targetted for you, call this before you start parsing:</p> <pre><code>$parser->accept_targets('*');</code></pre> </dd> <dt id="$parser->accept_targets_as_text(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Eaccept_targets_as_text(-SOMEVALUE-)">#</a><a id="accept_targets_as_text"></a><a id="parser-accept_targets_as_text-SOMEVALUE"></a><code>$parser->accept_targets_as_text( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This is like accept_targets, except that it specifies also that the content of sections for this target should be treated as Pod text even if the target name in "=for <i>targetname</i>" doesn't start with a ":".</p> <p>At time of writing, I don't think you'll need to use this.</p> </dd> <dt id="$parser->accept_codes(-Codename,-Codename...-)"><a class="permalink" href="#$parser-%3Eaccept_codes(-Codename,-Codename...-)">#</a><a id="accept_codes"></a><a id="parser-accept_codes-Codename-Codename"></a><code>$parser->accept_codes( <i>Codename</i>, <i>Codename</i>... )</code></dt> <dd> <p>This tells the parser that you accept additional formatting codes, beyond just the standard ones (I B C L F S X, plus the two weird ones you don't actually see in the parse tree, Z and E). For example, to also accept codes "N", "R", and "W":</p> <pre><code>$parser->accept_codes( qw( N R W ) );</code></pre> <p><b>TODO: document how this interacts with =extend, and long element names</b></p> </dd> <dt id="$parser->accept_directive_as_data(-directive_name-)"><a class="permalink" href="#$parser-%3Eaccept_directive_as_data(-directive_name-)">#</a><a id="accept_directive_as_data"></a><a id="parser-accept_directive_as_data-directive_name"></a><code>$parser->accept_directive_as_data( <i>directive_name</i> )</code></dt> <dd> </dd> <dt id="$parser->accept_directive_as_verbatim(-directive_name-)"><a class="permalink" href="#$parser-%3Eaccept_directive_as_verbatim(-directive_name-)">#</a><a id="accept_directive_as_verbatim"></a><a id="parser-accept_directive_as_verbatim-directive_name"></a><code>$parser->accept_directive_as_verbatim( <i>directive_name</i> )</code></dt> <dd> </dd> <dt id="$parser->accept_directive_as_processed(-directive_name-)"><a class="permalink" href="#$parser-%3Eaccept_directive_as_processed(-directive_name-)">#</a><a id="accept_directive_as_processed"></a><a id="parser-accept_directive_as_processed-directive_name"></a><code>$parser->accept_directive_as_processed( <i>directive_name</i> )</code></dt> <dd> <p>In the unlikely situation that you need to tell the parser that you will accept additional directives ("=foo" things), you need to first set the parset to treat its content as data (i.e., not really processed at all), or as verbatim (mostly just expanding tabs), or as processed text (parsing formatting codes like B<...>).</p> <p>For example, to accept a new directive "=method", you'd presumably use:</p> <pre><code>$parser->accept_directive_as_processed("method");</code></pre> <p>so that you could have Pod lines like:</p> <pre><code>=method I<$whatever> thing B<um></code></pre> <p>Making up your own directives breaks compatibility with other Pod formatters, in a way that using "=for <i>target</i> ..." lines doesn't; however, you may find this useful if you're making a Pod superset format where you don't need to worry about compatibility.</p> </dd> <dt id="$parser->nbsp_for_S(-BOOLEAN-);"><a class="permalink" href="#$parser-%3Enbsp_for_S(-BOOLEAN-);">#</a><a id="nbsp_for_S"></a><a id="parser-nbsp_for_S-BOOLEAN"></a><code>$parser->nbsp_for_S( <i>BOOLEAN</i> );</code></dt> <dd> <p>Setting this attribute to a true value (and by default it is false) will turn "S<...>" sequences into sequences of words separated by <code>\xA0</code> (non-breaking space) characters. For example, it will take this:</p> <pre><code class="plaintext">I like S<Dutch apple pie>, don't you?</code></pre> <p>and treat it as if it were:</p> <pre><code class="plaintext">I like DutchE<nbsp>appleE<nbsp>pie, don't you?</code></pre> <p>This is handy for output formats that don't have anything quite like an "S<...>" code, but which do have a code for non-breaking space.</p> <p>There is currently no method for going the other way; but I can probably provide one upon request.</p> </dd> <dt id="$parser->version_report()"><a class="permalink" href="#$parser-%3Eversion_report()">#</a><a id="version_report"></a><a id="parser-version_report"></a><code>$parser->version_report()</code></dt> <dd> <p>This returns a string reporting the $VERSION value from your module (and its classname) as well as the $VERSION value of Pod::Simple. Note that <a href="/5.10.1/perlpodspec">perlpodspec</a> requires output formats (wherever possible) to note this detail in a comment in the output format. For example, for some kind of SGML output format:</p> <pre><code>print OUT "<!-- \n", $parser->version_report, "\n -->";</code></pre> </dd> <dt id="$parser->pod_para_count()"><a class="permalink" href="#$parser-%3Epod_para_count()">#</a><a id="pod_para_count"></a><a id="parser-pod_para_count"></a><code>$parser->pod_para_count()</code></dt> <dd> <p>This returns the count of Pod paragraphs seen so far.</p> </dd> <dt id="$parser->line_count()"><a class="permalink" href="#$parser-%3Eline_count()">#</a><a id="line_count"></a><a id="parser-line_count"></a><code>$parser->line_count()</code></dt> <dd> <p>This is the current line number being parsed. But you might find the "line_number" event attribute more accurate, when it is present.</p> </dd> <dt id="$parser->nix_X_codes(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Enix_X_codes(-SOMEVALUE-)">#</a><a id="nix_X_codes"></a><a id="parser-nix_X_codes-SOMEVALUE"></a><code>$parser->nix_X_codes( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This attribute, when set to a true value (and it is false by default) ignores any "X<...>" sequences in the document being parsed. Many formats don't actually use the content of these codes, so have no reason to process them.</p> </dd> <dt id="$parser->merge_text(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Emerge_text(-SOMEVALUE-)">#</a><a id="merge_text"></a><a id="parser-merge_text-SOMEVALUE"></a><code>$parser->merge_text( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This attribute, when set to a true value (and it is false by default) makes sure that only one event (or token, or node) will be created for any single contiguous sequence of text. For example, consider this somewhat contrived example:</p> <pre><code class="plaintext">I just LOVE Z<>hotE<32>apple pie!</code></pre> <p>When that is parsed and events are about to be called on it, it may actually seem to be four different text events, one right after another: one event for "I just LOVE ", one for "hot", one for " ", and one for "apple pie!". But if you have merge_text on, then you're guaranteed that it will be fired as one text event: "I just LOVE hot apple pie!".</p> </dd> <dt id="$parser->code_handler(-CODE_REF-)"><a class="permalink" href="#$parser-%3Ecode_handler(-CODE_REF-)">#</a><a id="code_handler"></a><a id="parser-code_handler-CODE_REF"></a><code>$parser->code_handler( <i>CODE_REF</i> )</code></dt> <dd> <p>This specifies code that should be called when a code line is seen (i.e., a line outside of the Pod). Normally this is undef, meaning that no code should be called. If you provide a routine, it should start out like this:</p> <pre><code>sub get_code_line { # or whatever you'll call it my($line, $line_number, $parser) = @_; ... }</code></pre> <p>Note, however, that sometimes the Pod events aren't processed in exactly the same order as the code lines are -- i.e., if you have a file with Pod, then code, then more Pod, sometimes the code will be processed (via whatever you have code_handler call) before the all of the preceding Pod has been processed.</p> </dd> <dt id="$parser->cut_handler(-CODE_REF-)"><a class="permalink" href="#$parser-%3Ecut_handler(-CODE_REF-)">#</a><a id="cut_handler"></a><a id="parser-cut_handler-CODE_REF"></a><code>$parser->cut_handler( <i>CODE_REF</i> )</code></dt> <dd> <p>This is just like the code_handler attribute, except that it's for "=cut" lines, not code lines. The same caveats apply. "=cut" lines are unlikely to be interesting, but this is included for completeness.</p> </dd> <dt id="$parser->whine(-linenumber,-complaint-string-)"><a class="permalink" href="#$parser-%3Ewhine(-linenumber,-complaint-string-)">#</a><a id="whine"></a><a id="parser-whine-linenumber-complaint-string"></a><code>$parser->whine( <i>linenumber</i>, <i>complaint string</i> )</code></dt> <dd> <p>This notes a problem in the Pod, which will be reported to in the "Pod Errors" section of the document and/or send to STDERR, depending on the values of the attributes <code>no_whining</code>, <code>no_errata_section</code>, and <code>complain_stderr</code>.</p> </dd> <dt id="$parser->scream(-linenumber,-complaint-string-)"><a class="permalink" href="#$parser-%3Escream(-linenumber,-complaint-string-)">#</a><a id="scream"></a><a id="parser-scream-linenumber-complaint-string"></a><code>$parser->scream( <i>linenumber</i>, <i>complaint string</i> )</code></dt> <dd> <p>This notes an error like <code>whine</code> does, except that it is not suppressable with <code>no_whining</code>. This should be used only for very serious errors.</p> </dd> <dt id="$parser->source_dead(1)"><a class="permalink" href="#$parser-%3Esource_dead(1)">#</a><a id="source_dead"></a><a id="parser-source_dead-1"></a><code>$parser->source_dead(1)</code></dt> <dd> <p>This aborts parsing of the current document, by switching on the flag that indicates that EOF has been seen. In particularly drastic cases, you might want to do this. It's rather nicer than just calling <code>die</code>!</p> </dd> <dt id="$parser->hide_line_numbers(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Ehide_line_numbers(-SOMEVALUE-)">#</a><a id="hide_line_numbers"></a><a id="parser-hide_line_numbers-SOMEVALUE"></a><code>$parser->hide_line_numbers( <i>SOMEVALUE</i> )</code></dt> <dd> <p>Some subclasses that indescriminately dump event attributes (well, except for ones beginning with "~") can use this object attribute for refraining to dump the "start_line" attribute.</p> </dd> <dt id="$parser->no_whining(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Eno_whining(-SOMEVALUE-)">#</a><a id="no_whining"></a><a id="parser-no_whining-SOMEVALUE"></a><code>$parser->no_whining( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This attribute, if set to true, will suppress reports of non-fatal error messages. The default value is false, meaning that complaints <i>are</i> reported. How they get reported depends on the values of the attributes <code>no_errata_section</code> and <code>complain_stderr</code>.</p> </dd> <dt id="$parser->no_errata_section(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Eno_errata_section(-SOMEVALUE-)">#</a><a id="no_errata_section"></a><a id="parser-no_errata_section-SOMEVALUE"></a><code>$parser->no_errata_section( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This attribute, if set to true, will suppress generation of an errata section. The default value is false -- i.e., an errata section will be generated.</p> </dd> <dt id="$parser->complain_stderr(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Ecomplain_stderr(-SOMEVALUE-)">#</a><a id="complain_stderr"></a><a id="parser-complain_stderr-SOMEVALUE"></a><code>$parser->complain_stderr( <i>SOMEVALUE</i> )</code></dt> <dd> <p>This attribute, if set to true will send complaints to STDERR. The default value is false -- i.e., complaints do not go to STDERR.</p> </dd> <dt id="$parser->bare_output(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Ebare_output(-SOMEVALUE-)">#</a><a id="bare_output"></a><a id="parser-bare_output-SOMEVALUE"></a><code>$parser->bare_output( <i>SOMEVALUE</i> )</code></dt> <dd> <p>Some formatter subclasses use this as a flag for whether output should have prologue and epilogue code omitted. For example, setting this to true for an HTML formatter class should omit the "<html><head><title>...</title><body>..." prologue and the "</body></html>" epilogue.</p> <p>If you want to set this to true, you should probably also set <code>no_whining</code> or at least <code>no_errata_section</code> to true.</p> </dd> <dt id="$parser->preserve_whitespace(-SOMEVALUE-)"><a class="permalink" href="#$parser-%3Epreserve_whitespace(-SOMEVALUE-)">#</a><a id="preserve_whitespace"></a><a id="parser-preserve_whitespace-SOMEVALUE"></a><code>$parser->preserve_whitespace( <i>SOMEVALUE</i> )</code></dt> <dd> <p>If you set this attribute to a true value, the parser will try to preserve whitespace in the output. This means that such formatting conventions as two spaces after periods will be preserved by the parser. This is primarily useful for output formats that treat whitespace as significant (such as text or *roff, but not HTML).</p> </dd> </dl> <h1 id="SEE-ALSO"><a class="permalink" href="#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1> <p><a href="/5.10.1/Pod::Simple">Pod::Simple</a> -- event-based Pod-parsing framework</p> <p><a href="/5.10.1/Pod::Simple::Methody">Pod::Simple::Methody</a> -- like Pod::Simple, but each sort of event calls its own method (like <code>start_head3</code>)</p> <p><a href="/5.10.1/Pod::Simple::PullParser">Pod::Simple::PullParser</a> -- a Pod-parsing framework like Pod::Simple, but with a token-stream interface</p> <p><a href="/5.10.1/Pod::Simple::SimpleTree">Pod::Simple::SimpleTree</a> -- a Pod-parsing framework like Pod::Simple, but with a tree interface</p> <p><a href="/5.10.1/Pod::Simple::Checker">Pod::Simple::Checker</a> -- a simple Pod::Simple subclass that reads documents, and then makes a plaintext report of any errors found in the document</p> <p><a href="/5.10.1/Pod::Simple::DumpAsXML">Pod::Simple::DumpAsXML</a> -- for dumping Pod documents as tidily indented XML, showing each event on its own line</p> <p><a href="/5.10.1/Pod::Simple::XMLOutStream">Pod::Simple::XMLOutStream</a> -- dumps a Pod document as XML (without introducing extra whitespace as Pod::Simple::DumpAsXML does).</p> <p><a href="/5.10.1/Pod::Simple::DumpAsText">Pod::Simple::DumpAsText</a> -- for dumping Pod documents as tidily indented text, showing each event on its own line</p> <p><a href="/5.10.1/Pod::Simple::LinkSection">Pod::Simple::LinkSection</a> -- class for objects representing the values of the TODO and TODO attributes of L<...> elements</p> <p><a href="/5.10.1/Pod::Escapes">Pod::Escapes</a> -- the module the Pod::Simple uses for evaluating E<...> content</p> <p><a href="/5.10.1/Pod::Simple::Text">Pod::Simple::Text</a> -- a simple plaintext formatter for Pod</p> <p><a href="/5.10.1/Pod::Simple::TextContent">Pod::Simple::TextContent</a> -- like Pod::Simple::Text, but makes no effort for indent or wrap the text being formatted</p> <p><a href="/5.10.1/perlpod">perlpod</a></p> <p><a href="/5.10.1/perlpodspec">perlpodspec</a></p> <p><a href="/5.10.1/perldoc">perldoc</a></p> <h1 id="COPYRIGHT-AND-DISCLAIMERS"><a class="permalink" href="#COPYRIGHT-AND-DISCLAIMERS">#</a><a id="COPYRIGHT"></a>COPYRIGHT AND DISCLAIMERS</h1> <p>Copyright (c) 2002 Sean M. Burke. All rights reserved.</p> <p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> <p>This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.</p> <h1 id="AUTHOR"><a class="permalink" href="#AUTHOR">#</a>AUTHOR</h1> <p>Sean M. Burke <code>sburke@cpan.org</code></p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>