r31711@martha (orig r1246): groditi | 2009-10-02 17:01:17 -0400
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / HiddenArray.pm
CommitLineData
87b8ba85 1package Reaction::UI::ViewPort::Field::Mutable::HiddenArray;
7adfd53f 2
3use Reaction::Class;
81393881 4use namespace::clean -except => [ qw(meta) ];
7b5e71ad 5use MooseX::Types::Moose qw/ArrayRef/;
6
81393881 7extends 'Reaction::UI::ViewPort::Field';
8
1fb2fe93 9with 'Reaction::UI::ViewPort::Field::Role::Mutable' => { value_type => 'ArrayRef' };
81393881 10
1fb2fe93 11#has '+value' => (isa => ArrayRef);
81393881 12
13around value => sub {
14 my $orig = shift;
15 my $self = shift;
16 if (@_) {
17 #this hsould be done with coercions
18 $orig->($self, (ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ]));
19 $self->sync_to_action;
20 } else {
21 $orig->($self);
22 }
7adfd53f 23};
81393881 24sub _empty_value { [] };
25__PACKAGE__->meta->make_immutable;
26
7adfd53f 27
1734a92a 281;
7adfd53f 29
30=head1 NAME
31
87b8ba85 32Reaction::UI::ViewPort::Field::Mutable::HiddenArray
7adfd53f 33
34=head1 DESCRIPTION
35
36=head1 SEE ALSO
37
38=head2 L<Reaction::UI::ViewPort::Field>
39
40=head1 AUTHORS
41
42See L<Reaction::Class> for authors.
43
44=head1 LICENSE
45
46See L<Reaction::Class> for the license.
47
48=cut