NAME

Pod::Coverage::More::Blurb - Read the comment above each sub, which says what POD cannot be inferred from its code

VERSION

version 0.003

SYNOPSIS

use Pod::Coverage::More::Blurb;

my $blurbs = Pod::Coverage::More::Blurb->read_file( $INC{'Pod/Coverage/More/Blurb.pm'} );
my $resize = $blurbs->{read_file};

DESCRIPTION

A blurb is the block of comment lines directly above a sub, with no blank line between them and the sub, as # ABSTRACT: is the comment that names what a module is for:

# Resize the image to fit the box.
# @param   width   Int  in pixels
# @param   height  Int  in pixels
# @returns Image::Thing  the resized copy
# @throws  when either size is not positive
# @example my $small = $image->resize( 100, 50 );
sub resize {

The text before the first tag describes the sub; a comment line with nothing on it starts a new paragraph. Each tag starts a line, and a line without one continues the tag above it:

@param NAME TYPE DESCRIPTION - an argument. NAME may have its sigil. For a list parameter, such as the slurpy @paths of sub missing ($self, $snapshot, @paths), NAME with the sigil @ or % says that TYPE is the type of each element, or of each value of the hash: @param @paths Str each path to look for. Without the sigil, TYPE is the type of the parameter itself, and no type of a value describes a list.
@returns TYPE DESCRIPTION - the return value; @return is the same tag
@throws DESCRIPTION - how the sub fails; @dies is the same tag
@example CODE - one line of an example; consecutive lines make one example

TYPE is optional. It is a type word or a type expression that type_named of Pod::Coverage::More::Types reads, such as Int, ArrayRef[Str] or HashRef|Undef, or the name of a loaded package, which means an instance of it. A word that is neither starts the description.

A blurb sits above sub, and above the keywords method, fun and func that the class feature, Object::Pad, Function::Parameters and Kavorka define.

PERL::CRITIC

An @example line is code in a comment, on purpose. The policy Perl::Critic::Policy::Bangs::ProhibitCommentedOutCode reports such a line as commented-out code when it has an assignment, as # @example my $four = double(2); has. If your profile enables that policy, set its pattern so that a comment that starts with @example is no code:

[Bangs::ProhibitCommentedOutCode]
commentedcoderegex = \A(?!\#\s*\@example\b).*\$[A-Za-z_].*=

This is the default pattern of the policy, anchored at the start of the comment. An assignment in any other comment is still code.

BLURBS

read_file and read_string return a HASHREF from the name of each sub with a blurb to a HASHREF with:

description - ARRAYREF - the paragraphs of the text before the first tag
params - ARRAYREF - one HASHREF per @param, with name, as written, type, a Type::Tiny constraint or undef, and description
returns - HASHREF or undef - the @returns, with type and description
throws - ARRAYREF - the descriptions of the @throws tags
examples - ARRAYREF - one ARRAYREF of code lines per example
line - INTEGER - the line of the sub

METHODS

read_file(file)

The blurbs of the subs in file, as BLURBS describes them.

file - Str - the path of the file

Returns HashRef, from the name of each sub with a blurb to its blurb.

Dies when the file cannot be read.

my $blurbs = Pod::Coverage::More::Blurb->read_file('lib/Some/Module.pm');

read_string(source)

The blurbs of the subs in the perl source source, as BLURBS describes them.

source - Str - the perl source

Returns HashRef, from the name of each sub with a blurb to its blurb.

my $blurbs = Pod::Coverage::More::Blurb->read_string($source);

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.