Pod::Weaver is a tool that uses templates to generate documentation from POD source. It addresses issues like redundant documentation by following rules defined in a weaver.ini template file. This allows it to generate leaner POD that removes unneeded sections like NAME, VERSION, and AUTHORS. It also defines subroutines, methods, and attributes more cleanly. Pod::Weaver supports various output formats through different templates and can be used via Dist::Zilla or directly with the podweaver command.
24. [Collect / METHODS]
command = method
=head1 METHODS
=over
=item new() =method new()
creates an object creates an object
=item spawn() =method spawn()
spawns an object spawns an object
=back
20
25. [Collect / ATTRIBUTES]
command = attr
=head1 ATTRIBUTES
=over
=item torches()
number of torches
=item matches()
number of matches
=back
21
26. [Collect / ATTRIBUTES]
command = attr
=head1 ATTRIBUTES
=over
=item torches() =attr torches()
number of torches number of torches
=item matches() =attr matches()
number of matches number of matches
=back
22
28. [Leftovers]
=head1 SUPPORT weaver.ini
For support, please …
send a self-addressed,
stamped envelope to: [Leftovers]
Joshua Keroes [Region / postlude]
Somewhere in [Authors]
Portland, OR [Legal]
24
31. [Legal]
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Joshua
Keroes.
This is free software; you can redistribute it
and/or modify it under the same terms as the
Perl 5 programming language system itself.
27
43. References
This talk at SlideShare: http://xrl.us/jkeroespw
Dist::Zilla + Pod::Weaver http://xrl.us/dzilpw
What is Pod::Weaver 1? http://xrl.us/rjbspw1
What is POD::Weaver 2? http://xrl.us/rjbspw2
Falling in love with Pod::Weaver http://xrl.us/lovepw
39
Hinweis der Redaktion
\n
Show of hands and wild cheering please.\n(If >1: hire this champ)\n(If 0: typical. Fortunately, Pod::Weaver can help)\n\n
Why don’t we like to write docs?\nDRY. Heck, we already wrote the code, right?\nBeyond that, every module file in every module must have a NAME section. And an ABSTRACT. And they should have a COPYRIGHT, LICENSE, and AUTHOR(s), too. There’s a lot of repeated effort.\n
Why don’t we like to write docs?\nDRY. Heck, we already wrote the code, right?\nBeyond that, every module file in every module must have a NAME section. And an ABSTRACT. And they should have a COPYRIGHT, LICENSE, and AUTHOR(s), too. There’s a lot of repeated effort.\n
Should we really have to start a FUNCTIONS section? Is it a head1 or a head2? Why do we have to indent? Or remember to stop indenting, for that matter? And what if we want to intermingle POD with code?\n
Should we really have to start a FUNCTIONS section? Is it a head1 or a head2? Why do we have to indent? Or remember to stop indenting, for that matter? And what if we want to intermingle POD with code?\n
Why should you have to keep the copyright current? Honestly, we have a computer here.\n\n
Know what Perl's good at? Templating. Just count the number of template-related modules on CPAN. viz. http://mapofcpan.org/\n
weaver.ini is the template. Let’s take unwrap things a few levels. Default is a Pod::Weaver::PluginBundle::Default. The @-sign means PluginBundle instead of Plugin.\n
Let’s unwrap the CorePrep PluginBundle\n
Validate POD and make sure all sub-elements are nested under =head1’s. Good housekeeping, basically.\n
Undocumented treasure!\n
voila, the whole default template. Barring the two housekeeping plugins, the rest are in order. Let’s figure out what they do.\n
\n
Admittedly, this takes more typing. Fortunately, we can do better.\n
You need either a PODNAME or a package. The rule of thumb is to use PODNAME for programs and to package for modules.\n
Automatic and painless. podweaver gets it from a META.json or META.yml file. Under dzil, it depends which plugins are loaded in dist.ini, but that’s getting ahead of things.\n
Think of the GENERIC plugin as a pass-through. These three sections, named above, and their contents will pass through P::W relatively unharmed.\n
The collect plugin fetches and assembles sets of things. \n
PW will add the section header and add the indenting; we just list the functions and what they do.\n
The method collection uses the new =method keyword....\n
\n
Like Moose, Mouse, Moo, or Mo? =attr behaves just like the other collects. As with the other examples... Speaking of which, there are two plugins on CPAN you may find useful, one that adds an EXTENDS section; the other a CONSUMES section for Moose roles.\n
the shorthand on the right will generate the POD on the left.\n
Do you want to add generic/text before the synopsis? Text found here between a preludes =begin and =end or after a =for will be moved to the prelude location. This has to be generic text. I wasn’t able to add commands like =head1 successfully. We’ll look at another section that can handle this shortly.\n
Leftovers come before the postlude region. \n
Just like the prelude, the postlude will move generic/text after the leftovers.\n
Automatic. podweaver gets it from META.json or META.yml. Under dzil, it depends which plugins are loaded in dist.ini.\n
Automatic. podweaver gets it from META.json or META.yml. Under dzil, it depends which plugins are loaded in dist.ini.\n
\n
\n
\n
\n
\n
\n
\n
The numbers start at one and are auto-incremented.\n
\n
Add one line to run Pod::weaver during `dzil build`.\n