NAME
Sub::Meta::Returns - meta information about return values
SYNOPSIS
use Sub::Meta::Returns;
my $r = Sub::Meta::Returns->new(
    scalar  => 'Int',      # optional
    list    => 'ArrayRef', # optional
    void    => 'Void',     # optional
);
$r->scalar; # 'Int'
$r->list;   # 'ArrayRef'
$r->void;   # 'Void'
METHODS
new
Constructor of Sub::Meta::Returns.
ACCESSORS
scalar
A type for value when called in scalar context.
scalar- 
method scalar() => Maybe[Any] has_scalar- 
method has_scalar() => BoolWhether Sub::Meta::Returns has scalar type or not.
 set_scalar($type)- 
method set_scalar(Any $type) $selfSetter for
scalar. 
list
A type for value when called in list context.
list- 
method list() => Maybe[Any] has_list- 
method has_list() => BoolWhether Sub::Meta::Returns has list type or not.
 set_list($type)- 
method set_list(Any $type) => $selfSetter for
list. 
void
A type for value when called in void context.
void- 
method void() => Maybe[Any] has_void- 
method has_void() => BoolWhether Sub::Meta::Returns has void type or not.
 set_void($type)- 
method set_void(Any $type) => $selfSetter for
void. 
coerce
coercions.
coerce- 
method coerce() => Maybe[Any] has_coerce- 
method has_coerce() => BoolWhether Sub::Meta::Returns has coercions or not.
 set_coerce($bool)- 
method set_coerce(Bool $bool) => $selfSetter for
coerce. 
METHODS
is_same_interface($other_meta)
method is_same_interface(InstanceOf[Sub::Meta::Returns] $other_meta) => Bool
A boolean value indicating whether Sub::Meta::Returns object is same or not. Specifically, check whether scalar, list and void are equal.
is_relaxed_same_interface($other_meta)
method is_relaxed_same_interface(InstanceOf[Sub::Meta::Returns] $other_meta) => Bool
A boolean value indicating whether Sub::Meta::Returns object is same or not. Specifically, check whether scalar, list and void are satisfy the condition of $self side:
my $meta = Sub::Meta::Returns->new(scalar => 'Str')
my $other = Sub::Meta::Returns->new(scalar => 'Str', list => 'Int');
$meta->is_same_interface($other); # NG
$meta->is_relaxed_same_interface($other); # OK. The reason is that $meta does not specify the list type.
is_same_interface_inlined($other_meta_inlined)
method is_same_interface_inlined(InstanceOf[Sub::Meta::Returns] $other_meta) => Str
Returns inlined is_same_interface string.
is_relaxed_same_interface_inlined($other_meta_inlined)
method is_relaxed_same_interface_inlined(InstanceOf[Sub::Meta::Returns] $other_meta) => Str
Returns inlined is_relaxed_same_interface string.
error_message($other_meta)
method error_message(InstanceOf[Sub::Meta::Returns] $other_meta) => Str
Return the error message when the interface is not same. If same, then return empty string.
relaxed_error_message($other_meta)
method relaxed_error_message(InstanceOf[Sub::Meta::Returns] $other_meta) => Str
Return the error message when the interface does not satisfy the $self meta. If match, then return empty string.
display
method display() => Str
Returns the display of Sub::Meta::Returns:
use Sub::Meta::Returns;
use Types::Standard qw(Tuple Str);
my $meta = Sub::Meta::Returns->new(Tuple[Str,Str]);
$meta->display; # 'Tuple[Str,Str]'
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>