| HTTP-Body documentation | Contained in the HTTP-Body distribution. |
HTTP::Body::XFormsMultipart - HTTP Body XForms multipart/related submission Parser
use HTTP::Body::XForms;
HTTP Body XForms submission Parser. Inherits HTTP::Body::MultiPart.
This body type is used to parse XForms submission. In this case, the XML part that contains the model is indicated by the start attribute in the content-type. The XML content is stored unparsed on the parameter XForms:Model.
This function is overrided to detect the start part of the multipart/related post.
Defines the start part of the multipart/related body.
This function is overrided to differ the start part, which should be set as the XForms:Model param if its content type is application/xml.
Daniel Ruoso daniel@ruoso.com
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
| HTTP-Body documentation | Contained in the HTTP-Body distribution. |
package HTTP::Body::XFormsMultipart; BEGIN { $HTTP::Body::XFormsMultipart::VERSION = '1.12'; } use strict; use base 'HTTP::Body::MultiPart'; use bytes; use IO::File; use File::Temp 0.14;
sub init { my $self = shift; $self->SUPER::init(@_); unless ( $self->content_type =~ /start=\"?\<?([^\"\>;,]+)\>?\"?/ ) { my $content_type = $self->content_type; Carp::croak( "Invalid boundary in content_type: '$content_type'" ); } $self->{start} = $1; return $self; }
sub start { return shift->{start}; }
sub handler { my ( $self, $part ) = @_; my $contentid = $part->{headers}{'Content-ID'}; $contentid =~ s/^.*[\<\"]//; $contentid =~ s/[\>\"].*$//; if ( $contentid eq $self->start ) { $part->{name} = 'XForms:Model'; if ($part->{done}) { $self->body($part->{data}); } } elsif ( defined $contentid ) { $part->{name} = $contentid; $part->{filename} = $contentid; } return $self->SUPER::handler($part); }
1;