NAME

Pod::Coverage::More::Declared - What class builders and signature modules declare about the subs of a package

VERSION

version 0.001

SYNOPSIS

use Pod::Coverage::More::Declared;

my $declared = Pod::Coverage::More::Declared->declarations_for( 'Pod::Coverage::More::Declared', ['declarations_for'] );

DESCRIPTION

Class builders and signature modules keep what a programmer declared about a sub: the types of its parameters, which ones are required, what it returns, and which attribute an accessor reads. This module asks one provider per such system, and each provider answers only for a package that its system built. No provider loads its system, with one exception: a Moo class is read through its Moose metaclass, which loads Moose.

DECLARATIONS

A declaration is a HASHREF:

via - STRING - the system that declared it, such as Moose or Function::Parameters
role - STRING - constructor, reader, writer, accessor, predicate, clearer, method or function
params - ARRAYREF - one HASHREF per parameter: name, the variable or undef, index for a positional parameter or named for the key of a named one, type, a Type::Tiny constraint or undef, optional and invocant
returns - ARRAYREF - the Type::Tiny constraints that the sub is declared to return
attribute, documentation - STRING - the attribute that an accessor or a constructor parameter belongs to, and its documentation
body - CODEREF - the code that does the work, when the sub in the symbol table only wraps it

PROVIDERS

Pod::Coverage::More::Declared::TypeParams - signatures of Type::Params
Pod::Coverage::More::Declared::FunctionParameters - Function::Parameters
Pod::Coverage::More::Declared::Kavorka - Kavorka
Pod::Coverage::More::Declared::MOP - Moose, Mouse and Moo
Pod::Coverage::More::Declared::ObjectPad - Object::Pad
Pod::Coverage::More::Declared::ClassTiny - Class::Tiny

METHODS

declarations_for(package, names)

The declarations of the subs of package that names lists and a provider declares. When two providers declare the same sub, the first in PROVIDERS wins, and a body from a later one fills in a missing one.

package - Str - the name of the package
names - ArrayRef[Str] - the names of the subs

Returns HashRef, from the name of each declared sub to its declaration.

my $declared = Pod::Coverage::More::Declared->declarations_for( 'Some::Class', [ 'new', 'size' ] );

invocant(name)

The declaration of the invocant of a method, parameter 0, for the providers.

name - Maybe[Str] - the name of the invocant, or undef when it has none

Returns HashRef, the declaration of the parameter.

my $self = Pod::Coverage::More::Declared->invocant('$self');

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.