use stringification
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / HiddenArray.pm
1 package Reaction::UI::ViewPort::Field::HiddenArray;
2
3 use Reaction::Class;
4
5 class HiddenArray is 'Reaction::UI::ViewPort::Field', which {
6
7   has '+value' => (isa => 'ArrayRef');
8
9   around value => sub {
10     my $orig = shift;
11     my $self = shift;
12     if (@_) {
13       #this hsould be done with coercions
14       $orig->($self, (ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ]));
15       $self->sync_to_action;
16     } else {
17       $orig->($self);
18     }
19   };
20
21   implements _empty_value => as { [] };
22 };
23
24 1;
25
26 =head1 NAME
27
28 Reaction::UI::ViewPort::Field::HiddenArray
29
30 =head1 DESCRIPTION
31
32 =head1 SEE ALSO
33
34 =head2 L<Reaction::UI::ViewPort::Field>
35
36 =head1 AUTHORS
37
38 See L<Reaction::Class> for authors.
39
40 =head1 LICENSE
41
42 See L<Reaction::Class> for the license.
43
44 =cut