NAME
Pod::Coverage::More::Types - The Type::Tiny constraints that the evidence of an analysis amounts to
VERSION
version 0.003
SYNOPSIS
use Pod::Coverage::More::Types qw{type_of_value type_of_usage type_named};
my $returned = type_of_value( { type => 'object', class => 'Some::Class' } ); # InstanceOf["Some::Class"]
my $used = type_of_usage( { hashref => 1, methods => ['render'] } ); # HashRef&HasMethods["render"]
my $named = type_named('ArrayRef[Int]');
DESCRIPTION
Pod::Coverage::More::Analyzer records evidence about values: what a sub returns, and how it uses each variable. This module states that evidence as Type::Tiny constraints, so that the types that the code shows, the types that a class builder or a signature declares, and the types that the POD names can be compared as types.
Each function returns undef when the evidence says nothing about the type.
FUNCTIONS
type_of_value(EVIDENCE)
Returns the constraint that a value satisfies, from one HASHREF of evidence that classify of Pod::Coverage::More::Analyzer returns. A number whose evidence has a true integer, such as the count of an array, is an Int. With a true maybe_undef as well, as the length of a string, it is a Maybe[Int]. An object whose evidence names classes, as the numbers of the scope of use bignum, is an instance of one of them.
Returns a Type::Tiny object, or undef when the evidence says nothing of the type.
my $type = type_of_value( { type => 'number', integer => 1 } );
type_of_usage(USAGE)
Returns the constraint that a variable must satisfy for the uses that the HASHREF USAGE records, as analyze_sub of Pod::Coverage::More::Analyzer reports them.
Each kind of reference, and use as a number or as a string, is one alternative, because different branches of a sub can use one variable in different ways. The methods called on the variable apply to all of them.
Returns a Type::Tiny object, or undef when the uses say nothing of the type.
my $type = type_of_usage( { hashref => 1, methods => ['name'] } );
type_named(NAME)
Returns the constraint that NAME names. NAME is either a type word of the POD that Pod::Coverage::More reads, in any case, such as HASHREF or integer, or a type expression of Types::Standard, such as ArrayRef[Int]. A word for a container, ARRAY or HASH, names a reference to one.
Returns a Type::Tiny object, or undef when NAME names no type.
my $type = type_named('ArrayRef[Int]');
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.