Commit | Line | Data |
7adfd53f |
1 | package Reaction::Types::File; |
2 | |
7893faa8 |
3 | use MooseX::Types -declare => [qw/File Upload/]; |
7adfd53f |
4 | |
e739c9a2 |
5 | use MooseX::Types::Moose 'Object'; |
7893faa8 |
6 | use Path::Class::File; |
7 | |
8 | subtype File, as Object, where { $_->isa('Path::Class::File') }, |
9 | message { "Must be a file" }; |
10 | |
11 | subtype Upload, as Object, where { $_->isa('Catalyst::Request::Upload') }, |
12 | message { "Must be a file" }; |
13 | |
14 | coerce File, from Upload, via { Path::Class::File->new( $_->tempname ) }; |
15 | |
7adfd53f |
16 | 1; |
17 | |
18 | =head1 NAME |
19 | |
20 | Reaction::Types::File |
21 | |
22 | =head1 DESCRIPTION |
23 | |
24 | =over |
25 | |
26 | =item * File |
27 | |
28 | =back |
29 | |
30 | =head1 SEE ALSO |
31 | |
32 | =over |
33 | |
34 | =item * L<Reaction::Types::Core> |
35 | |
36 | =back |
37 | |
38 | =head1 AUTHORS |
39 | |
40 | See L<Reaction::Class> for authors. |
41 | |
42 | =head1 LICENSE |
43 | |
44 | See L<Reaction::Class> for the license. |
45 | |
46 | =cut |