NAME
Pod::Coverage::More::Documentation - What the POD of a module says about each of its subs
VERSION
version 0.003
SYNOPSIS
use Pod::Coverage::More::Documentation;
my $doc = Pod::Coverage::More::Documentation->new( subs => [qw{new parse_file section_for}] );
$doc->parse_file( $INC{'Pod/Coverage/More/Documentation.pm'} );
my $section = $doc->section_for('parse_file');
DESCRIPTION
Reads the POD of a module into one section per heading that documents subs. A heading documents subs when it is a =head2, =head3 or =head4, or a =method, =func or =attr of Pod::Weaver. It names one or more subs, each with an optional argument list in parentheses:
=head2 fun1(arg0, arg1), fun2(arg2)
=head2 wsSep wsSep2(whee, zap)
=head2 $obj->some_method(arr)
=method Some::Module::fully_qualified($x)
A section lasts until the next heading of the same level or a higher one. When new was given the names of the subs of the package, a heading that names none of them is not a section of its own, and a deeper one, such as =head3 CAVEAT, stays part of the section above it.
Within a section, an =item documents an argument: its first word is the name of the argument, and the segment after it, up to the next - or :, or in parentheses, is its type, a type word or a type expression that type_named of Pod::Coverage::More::Types reads:
=item count - INTEGER - how many
=item B<input> (ArrayRef[Str]) - the lines
An item whose name has the sigil @ or % documents a list parameter, and its type is the type of each element, or of each value of the hash:
=item @paths - Str - each path to look for
A paragraph that starts with Returns, or an =item Returns, documents the return value:
Returns HashRef[Str] or undef when the file is empty.
Returns a Foo object.
Returns nothing.
SECTIONS
section_for returns a HASHREF with these keys:
- heading - STRING - the text of the heading, without formatting codes
- line - INTEGER - the line of the heading
- functions - ARRAYREF - the names of the subs that the heading names
- args - HASHREF - per sub, the ARRAYREF of the argument names in its argument list, for a sub that has one
- types - HASHREF - per sub, a HASHREF from the lower case name of an argument without sigils to its documented type: a HASHREF with
word, the lower case text of the type, andtype, its Type::Tiny constraint or undef, or awordof the empty string for an item with no type, andsigil, the@or%that the item wrote before the name, or undef - returns - ARRAYREF - one HASHREF per statement of the return value, with
types, an ARRAYREF of Type::Tiny constraints,nothing, true for "Returns nothing",textandline - terminations - ARRAYREF - the paragraphs that say how the sub dies, croaks, throws or exits
- verbatim - ARRAYREF - the verbatim paragraphs
METHODS
bare_name(name)
name without its sigils and backslashes, in lower case, as arguments in the POD and parameters in the code are compared.
Returns Str, the bare name.
my $bare = Pod::Coverage::More::Documentation->bare_name('\%Options');
identifiers
The names of all the subs that the headings name, which Pod::Coverage counts as documented.
Returns the names, as a list.
my @documented = $doc->identifiers;
new(subs)
A reader of POD.
- subs - ArrayRef[Str] - optional: the names of the subs of the package, which tell the headings that document subs from the others
Returns a Pod::Coverage::More::Documentation object, the reader.
my $doc = Pod::Coverage::More::Documentation->new( subs => [ 'resize', 'crop' ] );
parse_file(file)
Reads the POD of file.
Returns a Pod::Coverage::More::Documentation object, the reader.
my $doc = Pod::Coverage::More::Documentation->new->parse_file('lib/Some/Module.pm');
parse_string(pod)
Reads the POD in the string pod.
Returns a Pod::Coverage::More::Documentation object, the reader.
my $doc = Pod::Coverage::More::Documentation->new->parse_string($pod);
section_for(name)
The first section whose heading names the sub name, or nothing.
Returns HashRef, the section.
my $section = $doc->section_for('resize');
sections
The sections, in the order of the POD, as SECTIONS describes them.
Returns the sections, as a list of HASHREFs.
my @headings = map { $_->{heading} } $doc->sections;
SEE ALSO
Please see those modules/websites for more information related to this module.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/teodesian/Pod-Coverage-More/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHORS
Current Maintainers:
George S. Baugh <teodesian@cpan.org>
COPYRIGHT AND LICENSE
Copyright (c) 2014-2026 George S. Baugh
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.