line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Body::XFormsMultipart; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$HTTP::Body::XFormsMultipart::VERSION = '1.19'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
39
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
249
|
|
7
|
7
|
|
|
7
|
|
36
|
use base 'HTTP::Body::MultiPart'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
683
|
|
8
|
7
|
|
|
7
|
|
39
|
use bytes; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
48
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
179
|
use IO::File; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
1339
|
|
11
|
7
|
|
|
7
|
|
40
|
use File::Temp 0.14; |
|
7
|
|
|
|
|
148
|
|
|
7
|
|
|
|
|
3404
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
HTTP::Body::XFormsMultipart - HTTP Body XForms multipart/related submission Parser |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use HTTP::Body::XForms; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
HTTP Body XForms submission Parser. Inherits HTTP::Body::MultiPart. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This body type is used to parse XForms submission. In this case, the |
26
|
|
|
|
|
|
|
XML part that contains the model is indicated by the start attribute |
27
|
|
|
|
|
|
|
in the content-type. The XML content is stored unparsed on the |
28
|
|
|
|
|
|
|
parameter XForms:Model. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item init |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This function is overridden to detect the start part of the |
37
|
|
|
|
|
|
|
multipart/related post. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
43
|
1
|
|
|
|
|
16
|
$self->SUPER::init(@_); |
44
|
1
|
50
|
|
|
|
6
|
unless ( $self->content_type =~ /start=\"?\([^\"\>;,]+)\>?\"?/ ) { |
45
|
0
|
|
|
|
|
0
|
my $content_type = $self->content_type; |
46
|
0
|
|
|
|
|
0
|
Carp::croak( "Invalid boundary in content_type: '$content_type'" ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
7
|
$self->{start} = $1; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
7
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item start |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Defines the start part of the multipart/related body. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub start { |
61
|
4
|
|
|
4
|
1
|
23
|
return shift->{start}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item handler |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This function is overridden to differ the start part, which should be |
67
|
|
|
|
|
|
|
set as the XForms:Model param if its content type is application/xml. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub handler { |
72
|
3
|
|
|
3
|
1
|
5
|
my ( $self, $part ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
5
|
my $contentid = $part->{headers}{'Content-ID'}; |
75
|
3
|
|
|
|
|
15
|
$contentid =~ s/^.*[\<\"]//; |
76
|
3
|
|
|
|
|
10
|
$contentid =~ s/[\>\"].*$//; |
77
|
|
|
|
|
|
|
|
78
|
3
|
100
|
|
|
|
9
|
if ( $contentid eq $self->start ) { |
|
|
50
|
|
|
|
|
|
79
|
1
|
|
|
|
|
3
|
$part->{name} = 'XForms:Model'; |
80
|
1
|
50
|
|
|
|
3
|
if ($part->{done}) { |
81
|
1
|
|
|
|
|
14
|
$self->body($part->{data}); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif ( defined $contentid ) { |
85
|
2
|
|
|
|
|
3
|
$part->{name} = $contentid; |
86
|
2
|
|
|
|
|
4
|
$part->{filename} = $contentid; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
14
|
return $self->SUPER::handler($part); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Daniel Ruoso C |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This library is free software . You can redistribute it and/or modify |
101
|
|
|
|
|
|
|
it under the same terms as perl itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |