aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-15 19:48:06 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-15 19:48:06 +0000
commitc497cbfbb4d0108f03bb9071c7c338b05b308aea (patch)
tree4ea34b2c2cf254fb3417aee3935c1b17c91334fe /lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm
parent105ffac741030225c5f621fd1751023eb5b63848 (diff)
downloadreaction-c497cbfbb4d0108f03bb9071c7c338b05b308aea.tar.gz
reaction-c497cbfbb4d0108f03bb9071c7c338b05b308aea.zip
how did hidden array end up here?
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm')
-rw-r--r--lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm b/lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm
new file mode 100644
index 0000000..13ad420
--- /dev/null
+++ b/lib/Reaction/UI/ViewPort/Field/Mutable/HiddenArray.pm
@@ -0,0 +1,44 @@
+package Reaction::UI::ViewPort::Field::HiddenArray;
+
+use Reaction::Class;
+
+class HiddenArray is 'Reaction::UI::ViewPort::Field', which {
+
+ has '+value' => (isa => 'ArrayRef');
+
+ around value => sub {
+ my $orig = shift;
+ my $self = shift;
+ if (@_) {
+ #this hsould be done with coercions
+ $orig->($self, (ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ]));
+ $self->sync_to_action;
+ } else {
+ $orig->($self);
+ }
+ };
+
+ implements _empty_value => as { [] };
+};
+
+1;
+
+=head1 NAME
+
+Reaction::UI::ViewPort::Field::HiddenArray
+
+=head1 DESCRIPTION
+
+=head1 SEE ALSO
+
+=head2 L<Reaction::UI::ViewPort::Field>
+
+=head1 AUTHORS
+
+See L<Reaction::Class> for authors.
+
+=head1 LICENSE
+
+See L<Reaction::Class> for the license.
+
+=cut