| 1 | package Prancer::Request::Upload; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings FATAL => 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | ▶ | use version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | our $VERSION = '1.05'; | |
| 8 | |||
| 9 | 3 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | # even though this *should* work automatically, it was not | ||
| 12 | 3 | our @CARP_NOT = qw(Prancer Try::Tiny); | |
| 13 | |||
| 14 | 3 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 15 | 3 | my ($class, $upload) = @_; | |
| 16 | 3 | return bless({ '_upload' => $upload }, $class); | |
| 17 | } | ||
| 18 | |||
| 19 | 1 | ▶ | sub filename { |
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | 1 | my $self = shift; | |
| 21 | 1 | return $self->{'_upload'}->filename(); | |
| 22 | } | ||
| 23 | |||
| 24 | 1 | ▶ | sub size { |
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 1 | my $self = shift; | |
| 26 | 1 | return $self->{'_upload'}->size(); | |
| 27 | } | ||
| 28 | |||
| 29 | 0 | ▶ | sub path { |
|
Subroutine
path: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | 0 | my $self = shift; | |
| 31 | 0 | return $self->{'_upload'}->path(); | |
| 32 | } | ||
| 33 | |||
| 34 | 1 | ▶ | sub content_type { |
|
Subroutine
content_type: called CC=1 SCAR=0.0
Pod
documented
| |||
| 35 | 1 | my $self = shift; | |
| 36 | 1 | return $self->{'_upload'}->content_type(); | |
| 37 | } | ||
| 38 | |||
| 39 | 3 | 1; | |
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | Prancer::Request::Upload | ||
| 44 | |||
| 45 | =head1 SYNOPSIS | ||
| 46 | |||
| 47 | Uploads come from the L<Prancer::Request> object passed to your handler. They | ||
| 48 | can be used like this: | ||
| 49 | |||
| 50 | # in your HTML | ||
| 51 | <form method="POST" enctype="multipart/form-data"> | ||
| 52 | <input type="file" name="foobar" /> | ||
| 53 | </form> | ||
| 54 | |||
| 55 | # in the Prancer handler | ||
| 56 | my $upload = $request->upload("foo"); | ||
| 57 | |||
| 58 | =head1 METHODS | ||
| 59 | |||
| 60 | =over | ||
| 61 | |||
| 62 | =item size | ||
| 63 | |||
| 64 | Returns the size of uploaded file. | ||
| 65 | |||
| 66 | =item path | ||
| 67 | |||
| 68 | Returns the path to the temporary file where uploaded file is saved. | ||
| 69 | |||
| 70 | =item content_type | ||
| 71 | |||
| 72 | Returns the content type of the uploaded file. | ||
| 73 | |||
| 74 | =item filename | ||
| 75 | |||
| 76 | Returns the original filename in the client. | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | =cut | ||