Reaction::UI::ViewPort::Field::Mutable::HiddenArray - Reaction::UI::ViewPort::Field::Mutable::HiddenArray documentation


Reaction documentation Contained in the Reaction distribution.

Index


Code Index:

NAME

Top

Reaction::UI::ViewPort::Field::Mutable::HiddenArray

DESCRIPTION

Top

SEE ALSO

Top

Reaction::UI::ViewPort::Field

AUTHORS

Top

See Reaction::Class for authors.

LICENSE

Top

See Reaction::Class for the license.


Reaction documentation Contained in the Reaction distribution.

package Reaction::UI::ViewPort::Field::Mutable::HiddenArray;

use Reaction::Class;
use namespace::clean -except => [ qw(meta) ];
use MooseX::Types::Moose qw/ArrayRef/;

extends 'Reaction::UI::ViewPort::Field';

with 'Reaction::UI::ViewPort::Field::Role::Mutable' => { value_type => 'ArrayRef' };

#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);
  }
};
sub _empty_value { [] };
__PACKAGE__->meta->make_immutable;


1;