| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::FormFu::QueryType::CGI::Simple; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'HTML::FormFu::QueryType::CGI'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub parse_uploads { |
|
11
|
5
|
|
|
5
|
0
|
6
|
my ( $class, $form, $name ) = @_; |
|
12
|
|
|
|
|
|
|
|
|
13
|
5
|
|
|
|
|
101
|
my $query = $form->query; |
|
14
|
5
|
|
|
|
|
16
|
my @params = $query->param($name); |
|
15
|
5
|
|
|
|
|
42
|
my @new; |
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
7
|
for my $param (@params) { |
|
18
|
7
|
100
|
|
|
|
16
|
if ( my $file = $query->upload($param) ) { |
|
19
|
6
|
|
|
|
|
245
|
my $filename = $param; |
|
20
|
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
183
|
$param = $class->new( { |
|
22
|
|
|
|
|
|
|
_param => $file, |
|
23
|
|
|
|
|
|
|
filename => $filename, |
|
24
|
|
|
|
|
|
|
parent => $form, |
|
25
|
|
|
|
|
|
|
} ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
6
|
|
|
|
|
19
|
my $headers = HTTP::Headers->new( |
|
28
|
|
|
|
|
|
|
'Content-Type' => $query->upload_info( $filename, 'mime' ), |
|
29
|
|
|
|
|
|
|
'Content-Length' => $query->upload_info( $filename, 'size' ), |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
485
|
$param->headers($headers); |
|
33
|
6
|
|
|
|
|
14
|
$param->size( $headers->content_length ); |
|
34
|
6
|
|
|
|
|
12
|
$param->type( $headers->content_type ); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
7
|
|
|
|
|
38
|
push @new, $param; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
5
|
50
|
|
|
|
10
|
return if !@new; |
|
40
|
|
|
|
|
|
|
|
|
41
|
5
|
100
|
|
|
|
19
|
return @new == 1 ? $new[0] : \@new; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub fh { |
|
45
|
3
|
|
|
3
|
1
|
2
|
my ($self) = @_; |
|
46
|
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
10
|
return $self->form->query->upload( $self->filename ); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
HTML::FormFu::QueryType::CGI::Simple - uploaded file |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
version 2.05 |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 headers |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Inherited, see L<HTML::FormFu::QueryType::CGI/headers> for details. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 filename |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Inherited, see L<HTML::FormFu::QueryType::CGI/filename> for details. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 fh |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns a read-only filehandle. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 slurp |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Inherited, see L<HTML::FormFu::QueryType::CGI/slurp> for details. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 size |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Inherited, see L<HTML::FormFu::QueryType::CGI/size> for details. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 type |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Inherited, see L<HTML::FormFu::QueryType::CGI/type> for details. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from |
|
93
|
|
|
|
|
|
|
L<HTML::FormFu::QueryType::CGI>, L<HTML::FormFu::Upload> |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L<HTML::FormFu>, L<HTML::FormFu::Element::File> |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LICENSE |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
|
104
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |