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
    coerce  => 1,          # optional
);

$r->scalar; # 'Int'
$r->list;   # 'ArrayRef'
$r->void;   # 'Void'
$r->coerce; # 1

METHODS

new

Constructor of Sub::Meta::Returns.

ACCESSORS

scalar

A type for value when called in scalar context.

set_scalar($scalar)

Setter for scalar.

list

A type for value when called in list context.

set_list($list)

Setter for list.

void

A type for value when called in void context.

set_void($void)

Setter for void.

coerce

A boolean whether with coercions.

set_coerce($bool)

Setter for coerce.

METHODS

is_same_interface($other_meta)

A boolean value indicating whether Sub::Meta::Returns object is same or not. Specifically, check whether scalar, list and void are equal.

is_same_interface_inlined($other_meta_inlined)

Returns inlined is_same_interface string.

display

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>