diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-07-24 01:42:34 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-07-24 01:42:34 +0000 |
commit | 8139388160b0a38002b22ff95c3fee3d8380f156 (patch) | |
tree | d7610c5db84c2c996107adb36bca1fe8a2b0b7cb /lib/Reaction/UI/ViewPort/Field/Mutable/File.pm | |
parent | 2a4c89335368295f0fc55f79d2c8fd5e33afd212 (diff) | |
download | reaction-8139388160b0a38002b22ff95c3fee3d8380f156.tar.gz reaction-8139388160b0a38002b22ff95c3fee3d8380f156.zip |
rclass stuff ripped out of everything but widget classes
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field/Mutable/File.pm')
-rw-r--r-- | lib/Reaction/UI/ViewPort/Field/Mutable/File.pm | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Mutable/File.pm b/lib/Reaction/UI/ViewPort/Field/Mutable/File.pm index ffbcbc9..d6d05c2 100644 --- a/lib/Reaction/UI/ViewPort/Field/Mutable/File.pm +++ b/lib/Reaction/UI/ViewPort/Field/Mutable/File.pm @@ -3,29 +3,30 @@ package Reaction::UI::ViewPort::Field::Mutable::File; use Reaction::Types::File qw/Upload/; use Reaction::Class; -class File is 'Reaction::UI::ViewPort::Field', which { - does 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple'; - - has '+value' => (isa => Upload); - - override apply_our_events => sub { - my ($self, $ctx, $events) = @_; - my $value_key = $self->event_id_for('value_string'); - if (my $upload = $ctx->req->upload($value_key)) { - local $events->{$value_key} = $upload; - return super(); - } else { - return super(); - } - }; - - implements adopt_value_string => sub { - my($self) = @_; - $self->value($self->value_string) if $self->value_string; - }; +use namespace::clean -except => [ qw(meta) ]; +extends 'Reaction::UI::ViewPort::Field'; + +with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple'; + +has '+value' => (isa => Upload); + +override apply_our_events => sub { + my ($self, $ctx, $events) = @_; + my $value_key = $self->event_id_for('value_string'); + if (my $upload = $ctx->req->upload($value_key)) { + local $events->{$value_key} = $upload; + return super(); + } else { + return super(); + } +}; +sub adopt_value_string { + my($self) = @_; + $self->value($self->value_string) if $self->value_string; +}; +override _value_string_from_value => sub { '' }; - overrides _value_string_from_value => sub { '' }; +__PACKAGE__->meta->make_immutable; -}; 1; |