16 use Moose::Util::TypeConstraints;
21 isa => subtype('ArrayRef' => where {
22 (blessed($_) && $_->isa('Customer') || return) for @$_; 1 }),
25 }, undef, '... successfully created attr' );
29 my $customer = Customer->new;
30 isa_ok($customer, 'Customer');
32 my $firm = Firm->new(customers => [ $customer ]);
33 isa_ok($firm, 'Firm');
35 can_ok($firm, 'customers');
40 '... got the right dereferenced value'
45 my $firm = Firm->new();
46 isa_ok($firm, 'Firm');
48 can_ok($firm, 'customers');
53 '... got the right dereferenced value'
63 isa => 'ArrayRef[Int]',
69 my $autoderef = AutoDeref->new;
72 $autoderef->bar(1, 2, 3);
73 }, undef, '... its auto-de-ref-ing, not auto-en-ref-ing' );
76 $autoderef->bar([ 1, 2, 3 ])
77 }, undef, '... set the results of bar correctly' );
79 is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';