NAME
Sub::Meta::Param - element of Sub::Meta::Parameters
SYNOPSIS
use Sub::Meta::Param
# specify all parameters
my $param = Sub::Meta::Param->new(
type => 'Str',
name => '$msg',
default => 'world',
coerce => 0,
optional => 0,
named => 0,
);
$param->type; # => 'Str'
# omit parameters
my $param = Sub::Meta::Param->new('Str');
$param->type; # => 'Str'
$param->positional; # => !!1
$param->required; # => !!1
METHODS
Constructor
new
Constructor of Sub::Meta::Param
.
Getter
name
variable name, e.g. $msg
, @list
.
type
Any type constraints
default
default value.
coerce
A boolean value indicating whether to coerce. Default to false.
optional
A boolean value indicating whether to optional. Default to false. This boolean is the opposite of required
.
required
A boolean value indicating whether to required. Default to true. This boolean is the opposite of optional
.
named
A boolean value indicating whether to named arguments. Default to false. This boolean is the opposite of positional
.
positional
A boolean value indicating whether to positional arguments. Default to true. This boolean is the opposite of positional
.
Setter
set_name(Str)
set_type(Any)
set_default(Any)
set_coerce(Bool)
set_optional(Bool = true)
set_required(Bool = true)
set_named(Bool = true)
set_positional(Bool = true)
SEE ALSO
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>