diff options
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm')
-rw-r--r-- | lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm b/lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm index 0bf0104..6f5129c 100644 --- a/lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm +++ b/lib/Reaction/UI/ViewPort/Field/Mutable/Array.pm @@ -2,17 +2,20 @@ package Reaction::UI::ViewPort::Field::Mutable::Array; use Reaction::Class; -class Array is 'Reaction::UI::ViewPort::Field::Array', which { - does 'Reaction::UI::ViewPort::Field::Role::Mutable'; +use namespace::clean -except => [ qw(meta) ]; +extends 'Reaction::UI::ViewPort::Field::Array'; - around value => sub { - my $orig = shift; - my $self = shift; - return $orig->($self) unless @_; - my $value = defined $_[0] ? $_[0] : []; - $orig->($self, (ref $value eq 'ARRAY' ? $value : [ $value ])); - }; +with 'Reaction::UI::ViewPort::Field::Role::Mutable'; + +around value => sub { + my $orig = shift; + my $self = shift; + return $orig->($self) unless @_; + my $value = defined $_[0] ? $_[0] : []; + $orig->($self, (ref $value eq 'ARRAY' ? $value : [ $value ])); }; +__PACKAGE__->meta->make_immutable; + 1; |