Moo
view release on metacpan or search on metacpan
xt/croak-locations.t view on Meta::CPAN
$PACKAGE->meta->name;
END_CODE
{
local $TODO = "croaks in roles don't skip consuming class";
location_ok <<'END_CODE', 'Moo::Role::_inhale_if_moose - isa from type';
BEGIN {
eval qq{
package ${PACKAGE}::Role;
use Moose::Role;
has attr1 => (is => 'ro', isa => 'HashRef');
1;
} or die $@;
}
use Moo;
with "${PACKAGE}::Role";
package Elsewhere;
$PACKAGE->new(attr1 => []);
END_CODE
}
xt/type-inflate-coercion.t view on Meta::CPAN
Moose::Util::TypeConstraints::find_type_constraint("ArrayRef");
};
return ($type, @_);
}
{
package ClassWithTypes;
$INC{'ClassWithTypes.pm'} = __FILE__;
use Moo;
has split_comma => (is => 'ro', isa => ::ArrayRef, coerce => sub { [ split /,/, $_[0] ] } );
has split_space => (is => 'ro', isa => ::ArrayRef, coerce => sub { [ split / /, $_[0] ] } );
has bad_coerce => (is => 'ro', isa => ::ArrayRef, coerce => sub { $_[0] } );
}
my $o = ClassWithTypes->new(split_comma => 'a,b c,d', split_space => 'a,b c,d');
is_deeply $o->split_comma, ['a','b c','d'], 'coerce with prebuilt type works';
is_deeply $o->split_space, ['a,b','c,d'], ' ... and with different coercion on same type';
{
package MooseSubclassWithTypes;
use Moose;
extends 'ClassWithTypes';
( run in 0.832 second using v1.01-cache-2.11-cpan-5f2e87ce722 )