3 use warnings FATAL => 'all';
5 eval { require Moose; require MooseX::Types }
7 : (skip_all => "Moose, MooseX::Types required for testing types")
13 use MooseX::Types::Moose qw/Str/;
14 use Moose::Util::TypeConstraints;
15 use MooseX::Types -declare => [qw/CustomType/];
20 where { length($_) == 2 };
26 use Function::Parameters qw(:strict);
27 BEGIN { MyTypes->import('CustomType') };
28 use MooseX::Types::Moose qw/ArrayRef/;
29 #use namespace::clean;
31 method foo ((CustomType) $bar) { }
33 method bar ((ArrayRef[CustomType]) $baz) { }
36 my $o = bless {} => 'TestClass';
38 is(exception { $o->foo('42') }, undef);
39 ok(exception { $o->foo('bar') });
41 is(exception { $o->bar(['42', '23']) }, undef);
42 ok(exception { $o->bar(['foo', 'bar']) });