Sub::Meta::Param - element of Sub::Meta::Parameters
use Sub::Meta::Param # specify all parameters my $param = Sub::Meta::Param->new( type => 'Str', name => '$msg', default => 'world', coerce => 0, optional => 0, # default named => 0, # default ); $param->type; # => 'Str' # omit parameters my $param = Sub::Meta::Param->new('Str'); $param->type; # => 'Str' $param->positional; # => !!1 $param->required; # => !!1
Constructor of Sub::Meta::Param.
Sub::Meta::Param
use Types::Standard -types; Sub::Meta::Param->new({ type => ArrayRef[Int], required => 1, positional => 1, })
variable name, e.g. $msg, @list.
$msg
@list
Setter for name.
name
Any type constraints, e.g. Str.
Str
Setter for type.
type
default value, e.g. "HELLO", sub { ... }
"HELLO"
sub { ... }
Setter for default.
default
A boolean value indicating whether to coerce. Default to false.
Setter for coerce.
coerce
A boolean value indicating whether to optional. Default to false. This boolean is the opposite of required.
required
Setter for optional.
optional
A boolean value indicating whether to required. Default to true. This boolean is the opposite of optional.
Setter for required.
A boolean value indicating whether to named arguments. Default to false. This boolean is the opposite of positional.
positional
Setter for named.
named
A boolean value indicating whether to positional arguments. Default to true. This boolean is the opposite of positional.
Setter for positional.
A boolean value indicating whether Sub::Meta::Param object is same or not. Specifically, check whether name, type, optional and named are equal.
Sub::Meta::Parameters
Copyright (C) kfly8.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
kfly8 <kfly@cpan.org>
To install Sub::Meta, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sub::Meta
CPAN shell
perl -MCPAN -e shell install Sub::Meta
For more information on module installation, please visit the detailed CPAN module installation guide.