line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
4939
|
use strict; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
396
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Upload; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Upload::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: uploaded file |
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
48
|
use Moose; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
72
|
|
8
|
8
|
|
|
8
|
|
53107
|
use MooseX::Attribute::Chained; |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
331
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'HTML::FormFu::Role::Populate'; |
11
|
|
|
|
|
|
|
|
12
|
8
|
|
|
8
|
|
49
|
use HTML::FormFu::ObjectUtil qw( form parent ); |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
468
|
|
13
|
8
|
|
|
8
|
|
3396
|
use HTML::FormFu::UploadParam; |
|
8
|
|
|
|
|
30
|
|
|
8
|
|
|
|
|
2031
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has headers => ( is => 'rw', traits => ['Chained'] ); |
16
|
|
|
|
|
|
|
has filename => ( is => 'rw', traits => ['Chained'] ); |
17
|
|
|
|
|
|
|
has size => ( is => 'rw', traits => ['Chained'] ); |
18
|
|
|
|
|
|
|
has type => ( is => 'rw', traits => ['Chained'] ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub BUILD { } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _param { |
23
|
23
|
|
|
23
|
|
274
|
my ( $self, $param ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
23
|
100
|
|
|
|
359
|
if ( @_ > 1 ) { |
26
|
18
|
|
|
|
|
586
|
$param = HTML::FormFu::UploadParam->new( { param => $param, } ); |
27
|
|
|
|
|
|
|
|
28
|
18
|
|
|
|
|
110
|
$param->form( $self->form ); |
29
|
|
|
|
|
|
|
|
30
|
18
|
|
|
|
|
34
|
$self->{_param} = $param; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
23
|
50
|
|
|
|
705
|
return defined $self->{_param} ? $self->{_param}->param : (); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub slurp { |
37
|
5
|
|
|
5
|
0
|
1840
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
18
|
my $fh = $self->fh; |
40
|
|
|
|
|
|
|
|
41
|
5
|
50
|
|
|
|
15
|
return if !defined $fh; |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
18
|
binmode $fh; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
16
|
local $/; |
46
|
|
|
|
|
|
|
|
47
|
5
|
|
|
|
|
156
|
return <$fh>; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
HTML::FormFu::Upload - uploaded file |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 2.07 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
An instance is created for each uploaded file. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
You will normally get an object of one of the following classes, which inherit |
73
|
|
|
|
|
|
|
from L<HTML::FormFu::Upload>: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item L<HTML::FormFu::QueryType::CGI> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item L<HTML::FormFu::QueryType::Catalyst> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item L<HTML::FormFu::QueryType::CGI::Simple> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 parent |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns the L<field|HTML::FormFu::Role::Element::Field> object that the upload |
90
|
|
|
|
|
|
|
object is associated with. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 form |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns the L<HTML::FormFu> object that the upload object's field is attached |
95
|
|
|
|
|
|
|
to. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 populate |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
See L<HTML::FormFu/populate> for details. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SEE ALSO |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L<HTML::FormFu> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 LICENSE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
112
|
|
|
|
|
|
|
the same terms as Perl itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
123
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |