Pod::S...ethody(3perl)
π NAME π
Pod::Simple::Methody β bestie, this one turns Pod::Simple events into method calls. That's the whole vibe. β¨
It's a Perl thing, from the Perl Programmers Reference Guide, and it's lowkey tiny but highkey iconic. π
πΈ SYNOPSIS πΈ
okay so you set it up like this, no cap:
require 5;
use strict;
package SomePodFormatter;
use base qw(Pod::Simple::Methody);
sub handle_text {
my($self, $text) = @_;
...
}
sub start_head1 {
my($self, $attrs) = @_;
...
}
sub end_head1 {
my($self) = @_;
...
}
...and start_/end_ methods for whatever other events you want to catch.
literally just start_ / end_ methods for whatever other events you wanna catch, and you're golden π«Ά
π¦ DESCRIPTION π¦
So this class is for the girlies writing Pod formatters on top of Pod::Simple. If that's you: hi, this is your moment. π
This class is very small β like, read the source, it's right there β and what it does is override Pod::Simple's _handle_element_start, _handle_text, and _handle_element_end methods, so that parser events get turned into method calls. (Otherwise? It's just a subclass of Pod::Simple and inherits all of its methods. Nothing spooky. π)
You can use it as the base class for a Pod formatter/processor. That's the assignment. π
β¨ METHOD CALLING β¨
Okay bestie, here's where it ate. π
When Pod::Simple sees a "=head1 Hi there", for example, it basically does this:
$parser->_handle_element_start( "head1", \%attributes );
$parser->_handle_text( "Hi there" );
$parser->_handle_element_end( "head1" );
But if you subclass Pod::Simple::Methody, it will instead do this when it sees a "=head1 Hi there":
$parser->start_head1( \%attributes ) if $parser->can('start_head1');
$parser->handle_text( "Hi there" ) if $parser->can('handle_text');
$parser->end_head1() if $parser->can('end_head1');
See the if $parser->can(...)? It only calls the method if you actually have it. No missing-method meltdowns. We love a considerate icon. π
Now β plot twist β if Pod::Simple sends an event where the element name has a dash, period, or colon, the corresponding method name will have a underscore in its place. Example, "foo.bar:baz" becomes start_foo_bar_baz and end_foo_bar_baz. So dashes, dots and colons all get glowed-up into underscores. π
If you want to see this class in action, peep the source for Pod::Simple::Text β it's the example. π
π SEE ALSO π
Pod::SimplePod::Simple::Subclassing
π SUPPORT π
Got questions? Wanna discuss POD and Pod::Simple? Send them to the pod-people@perl.org mail list. And if you wanna subscribe β just send an empty email to pod-people-subscribe@perl.org and boom, you're in. ποΈ
This module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>. Feel free to fork and contribute, or to clone <https://github.com/perl-pod/pod-simple.git> and send patches! Fr fr, they want your patches. π«Ά
Patches against Pod::Simple are welcome. Please send bug reports to <bug-pod-simple@rt.cpan.org>.
For real though β patches welcome, bug reports wanted, nobody's gatekeeping here. β¨
π COPYRIGHT AND DISCLAIMERS π
Copyright (c) 2002 Sean M. Burke.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
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.
β οΈ No promises, no guarantees β the "hope it's useful" clause is doing a lot of heavy lifting there. Just so you know. π
π AUTHOR π
Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't bother him, he's retired. (Iconic behavior, honestly. Respect the retirement. π)
Pod::Simple is maintained by:
- Allison Randal
"allison@perl.org" - Hans Dieter Pearcey
"hdp@cpan.org" - David E. Wheeler
"dwheeler@cpan.org"
aaaand that's the whole page, bestie π this was Pod::S...ethody(3perl) from the Perl Programmers Reference Guide, sitting pretty at perl v5.44.0, dated 2026-10-17. go forth and subclass, you absolute main character π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms