line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Prancer::Request::Upload; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings FATAL => 'all'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
133
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
16
|
use version; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.05'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
238
|
use Carp; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
733
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# even though this *should* work automatically, it was not |
12
|
|
|
|
|
|
|
our @CARP_NOT = qw(Prancer Try::Tiny); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
3
|
|
|
3
|
0
|
8
|
my ($class, $upload) = @_; |
16
|
3
|
|
|
|
|
16
|
return bless({ '_upload' => $upload }, $class); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub filename { |
20
|
1
|
|
|
1
|
1
|
491
|
my $self = shift; |
21
|
1
|
|
|
|
|
10
|
return $self->{'_upload'}->filename(); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub size { |
25
|
1
|
|
|
1
|
1
|
531
|
my $self = shift; |
26
|
1
|
|
|
|
|
6
|
return $self->{'_upload'}->size(); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub path { |
30
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
31
|
0
|
|
|
|
|
0
|
return $self->{'_upload'}->path(); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub content_type { |
35
|
1
|
|
|
1
|
1
|
540
|
my $self = shift; |
36
|
1
|
|
|
|
|
7
|
return $self->{'_upload'}->content_type(); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Prancer::Request::Upload |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Uploads come from the L object passed to your handler. They |
48
|
|
|
|
|
|
|
can be used like this: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# in your HTML |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
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 |