11 use Moose::Util::TypeConstraints;
13 subtype 'UCArray', as 'ArrayRef[Str]', where {
14 !grep {/[a-z]/} @{$_};
17 coerce 'UCArray', from 'ArrayRef[Str]', via {
18 [ map { uc $_ } @{$_} ];
40 default => sub { ['a'] },
45 trigger => sub { @TriggerArgs = @_ },
46 clearer => 'clear_lazy',
53 $foo->array( [qw( A B C )] );
55 $foo->push_array('d');
58 $foo->array, [qw( A B C D )],
59 'push coerces the array'
62 $foo->set_array( 1 => 'x' );
65 $foo->array, [qw( A X C D )],
66 'set coerces the array'
74 $foo->lazy, [qw( A D )],
75 'push coerces the array - lazy'
80 [ $foo, [qw( A D )], ['A'] ],
81 'trigger receives expected arguments'
84 $foo->set_lazy( 2 => 'f' );
87 $foo->lazy, [qw( A D F )],
88 'set coerces the array - lazy'
93 [ $foo, [qw( A D F )], [qw( A D )] ],
94 'trigger receives expected arguments'