« blib/lib/FormValidator/Lite/Upload/HTTPEngine.pm
↑ Summary
blib/lib/FormValidator/Lite/Constraint/File.pm »
| 1 | package FormValidator::Lite::Upload::PlackRequest; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use base qw/FormValidator::Lite::Upload/; | ||
| 5 | |||
| 6 | sub new { | ||
| 7 | my ($class, $q, $name) = @_; | ||
| 8 | my $upload = $q->upload($name); | ||
| 9 | return unless $upload; | ||
| 10 | |||
| 11 | bless { | ||
| 12 | q => $q, | ||
| 13 | name => $name, | ||
| 14 | upload => $upload, | ||
| 15 | }, $class; | ||
| 16 | } | ||
| 17 | |||
| 18 | sub size { shift->{upload}->size } | ||
| 19 | sub type { shift->{upload}->type } | ||
| 20 | |||
| 21 | sub fh { | ||
| 22 | my ($self, ) = @_; | ||
| 23 | my $fname = $self->{upload}->path; | ||
| 24 | open my $fh, '<', $fname or die "cannot open temporary file: $fname: $!"; | ||
| 25 | return $fh; | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; | ||
| 29 |