Moose
view release on metacpan or search on metacpan
inc/Documentation.pm view on Meta::CPAN
# add x_documentation metadata
# see https://github.com/metacpan/metacpan-web/issues/1468#event-283925638
use Moose;
with 'Dist::Zilla::Role::MetaProvider';
sub mvp_multivalue_args { 'module' }
has module => (
is => 'ro', isa => 'ArrayRef[Str]',
required => 1,
);
sub metadata
{
my $self = shift;
return +{ x_documentation => $self->module };
}
1;
lib/Moose/Manual/Types.pod view on Meta::CPAN
However, before you do this, you should look at the L<MooseX::Types>
module. This module makes it easy to create a "type library" module, which can
export your types as perl constants.
has 'counter' => (is => 'rw', isa => PositiveInt);
This lets you use a short name rather than needing to fully qualify the name
everywhere. It also allows you to easily create parameterized types:
has 'counts' => (is => 'ro', isa => HashRef[PositiveInt]);
This module will check your names at compile time, and is generally more
robust than the string type parsing for complex cases.
=head1 COERCION
A coercion lets you tell Moose to automatically convert one type to another.
subtype 'ArrayRefOfInts',
as 'ArrayRef[Int]';
( run in 1.000 second using v1.01-cache-2.11-cpan-5f2e87ce722 )