NAME

Sub::Meta::Type - type constraints for Sub::Meta

SYNOPSIS

my $submeta = Sub::Meta->new(
    subname => 'hello',
);

my $type = Sub::Meta::Type->new(
    submeta              => $submeta,
    submeta_strict_check => !!0,
    find_submeta         => \&Sub::Meta::CreatorFunction::find_submeta,
);

sub hello {}
my $meta = $type->coerce(\&hello);
$type->check($meta)

DESCRIPTION

This module provides types for Sub::Meta.

ATTRIBUTES

submeta

method submeta() => InstanceOf[Sub::Meta]

Accessor for Sub::Meta.

submeta_strict_check

method submeta_strict_check() => Bool

Whether Sub::Meta::Type check by is_strict_same_interface or not. If false, then check by is_relaxed_same_interface.

find_submeta

method find_submeta() => CodeRef[ Ref['CODE'] => Maybe[InstanceOf[Sub::Meta]] ]

Code reference for finding Sub::Meta from a subroutine like Sub::Meta::CreatorFunction::find_submeta

METHODS

get_detail_message

method get_detail_message(InstanceOf['Sub::Meta'] $submeta) => Str

Returns the detailed reason for the error message for a value; even if the value passes the type constraint. This method is used inside Type#get_message and TypeSub#get_message.

SEE ALSO

Types::Sub, Sub::Meta::TypeSub

LICENSE

Copyright (C) kfly8.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

kfly8 <kfly@cpan.org>