1Pod::Simple::Methody(3)User Contributed Perl DocumentatioPnod::Simple::Methody(3)
2
3
4
6 Pod::Simple::Methody -- turn Pod::Simple events into method calls
7
9 require 5;
10 use strict;
11 package SomePodFormatter;
12 use base qw(Pod::Simple::Methody);
13
14 sub handle_text {
15 my($self, $text) = @_;
16 ...
17 }
18
19 sub start_head1 {
20 my($self, $attrs) = @_;
21 ...
22 }
23 sub end_head1 {
24 my($self) = @_;
25 ...
26 }
27
28 ...and start_/end_ methods for whatever other events you want to catch.
29
31 This class is of interest to people writing Pod formatters based on
32 Pod::Simple.
33
34 This class (which is very small -- read the source) overrides
35 Pod::Simple's _handle_element_start, _handle_text, and
36 _handle_element_end methods so that parser events are turned into
37 method calls. (Otherwise, this is a subclass of Pod::Simple and
38 inherits all its methods.)
39
40 You can use this class as the base class for a Pod formatter/processor.
41
43 When Pod::Simple sees a "=head1 Hi there", for example, it basically
44 does this:
45
46 $parser->_handle_element_start( "head1", \%attributes );
47 $parser->_handle_text( "Hi there" );
48 $parser->_handle_element_end( "head1" );
49
50 But if you subclass Pod::Simple::Methody, it will instead do this when
51 it sees a "=head1 Hi there":
52
53 $parser->start_head1( \%attributes ) if $parser->can('start_head1');
54 $parser->handle_text( "Hi there" ) if $parser->can('handle_text');
55 $parser->end_head1() if $parser->can('end_head1');
56
57 If Pod::Simple sends an event where the element name has a dash,
58 period, or colon, the corresponding method name will have a underscore
59 in its place. For example, "foo.bar:baz" becomes start_foo_bar_baz and
60 end_foo_bar_baz.
61
62 See the source for Pod::Simple::Text for an example of using this
63 class.
64
66 Pod::Simple, Pod::Simple::Subclassing
67
69 Questions or discussion about POD and Pod::Simple should be sent to the
70 pod-people@perl.org mail list. Send an empty email to
71 pod-people-subscribe@perl.org to subscribe.
72
73 This module is managed in an open GitHub repository,
74 <https://github.com/perl-pod/pod-simple/>. Feel free to fork and
75 contribute, or to clone <git://github.com/perl-pod/pod-simple.git> and
76 send patches!
77
78 Patches against Pod::Simple are welcome. Please send bug reports to
79 <bug-pod-simple@rt.cpan.org>.
80
82 Copyright (c) 2002 Sean M. Burke.
83
84 This library is free software; you can redistribute it and/or modify it
85 under the same terms as Perl itself.
86
87 This program is distributed in the hope that it will be useful, but
88 without any warranty; without even the implied warranty of
89 merchantability or fitness for a particular purpose.
90
92 Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't
93 bother him, he's retired.
94
95 Pod::Simple is maintained by:
96
97 · Allison Randal "allison@perl.org"
98
99 · Hans Dieter Pearcey "hdp@cpan.org"
100
101 · David E. Wheeler "dwheeler@cpan.org"
102
103
104
105perl v5.30.1 2020-01-30 Pod::Simple::Methody(3)