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