1 package HTTP::Body::XFormsMultipart;
4 use base 'HTTP::Body::MultiPart';
12 HTTP::Body::XFormsMultipart - HTTP Body XForms multipart/related submission Parser
16 use HTTP::Body::XForms;
20 HTTP Body XForms submission Parser. Inherits HTTP::Body::MultiPart.
22 This body type is used to parse XForms submission. In this case, the
23 XML part that contains the model is indicated by the start attribute
24 in the content-type. The XML content is stored unparsed on the
25 parameter XForms:Model.
33 This function is overrided to detect the start part of the
34 multipart/related post.
40 $self->SUPER::init(@_);
41 unless ( $self->content_type =~ /start=\"?\<?([^\"\>;,]+)\>?\"?/ ) {
42 my $content_type = $self->content_type;
43 Carp::croak( "Invalid boundary in content_type: '$content_type'" );
53 Defines the start part of the multipart/related body.
58 return shift->{start};
63 This function is overrided to differ the start part, which should be
64 set as the XForms:Model param if its content type is application/xml.
69 my ( $self, $part ) = @_;
71 my $contentid = $part->{headers}{'Content-ID'};
72 $contentid =~ s/^.*[\<\"]//;
73 $contentid =~ s/[\>\"].*$//;
75 if ( $contentid eq $self->start ) {
76 $part->{name} = 'XForms:Model';
78 elsif ( defined $contentid ) {
79 $part->{name} = $contentid;
80 $part->{filename} = $contentid;
83 return $self->SUPER::handler($part);
90 Daniel Ruoso C<daniel@ruoso.com>
94 This library is free software . You can redistribute it and/or modify
95 it under the same terms as perl itself.