« lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm
↑ Summary
script/componentui_cgi.pl »
| 1 | package Reaction::UI::ViewPort::InterfaceModel::Field::File; | ||
| 2 | |||
| 3 | use Reaction::Class; | ||
| 4 | use Reaction::Types::File; | ||
| 5 | |||
| 6 | use namespace::clean -except => [ qw(meta) ]; | ||
| 7 | extends 'Reaction::UI::ViewPort::InterfaceModel::Field'; | ||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | has '+value' => (isa => 'File', required => 0); | ||
| 12 | |||
| 13 | override apply_our_events => sub { | ||
| 14 | my ($self, $ctx, $events) = @_; | ||
| 15 | my $value_key = join(':', $self->location, 'value'); | ||
| 16 | if (my $upload = $ctx->req->upload($value_key)) { | ||
| 17 | local $events->{$value_key} = $upload; | ||
| 18 | return super(); | ||
| 19 | } else { | ||
| 20 | return super(); | ||
| 21 | } | ||
| 22 | }; | ||
| 23 | |||
| 24 | __PACKAGE__->meta->make_immutable; | ||
| 25 | |||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | Reaction::UI::ViewPort::Field::File | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | =head1 SEE ALSO | ||
| 36 | |||
| 37 | =head2 L<Reaction::UI::ViewPort::Field> | ||
| 38 | |||
| 39 | =head1 AUTHORS | ||
| 40 | |||
| 41 | See L<Reaction::Class> for authors. | ||
| 42 | |||
| 43 | =head1 LICENSE | ||
| 44 | |||
| 45 | See L<Reaction::Class> for the license. | ||
| 46 | |||
| 47 | =cut |