← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:09 2016

Filename/usr/local/share/perl/5.18.2/HTTP/Body/XFormsMultipart.pm
StatementsExecuted 14 statements in 328µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs79µsHTTP::Body::XFormsMultipart::::BEGIN@11HTTP::Body::XFormsMultipart::BEGIN@11
1119µs21µsHTTP::Body::XFormsMultipart::::BEGIN@6HTTP::Body::XFormsMultipart::BEGIN@6
1118µs66µsHTTP::Body::XFormsMultipart::::BEGIN@7HTTP::Body::XFormsMultipart::BEGIN@7
1118µs9µsHTTP::Body::XFormsMultipart::::BEGIN@8HTTP::Body::XFormsMultipart::BEGIN@8
1117µs117µsHTTP::Body::XFormsMultipart::::BEGIN@10HTTP::Body::XFormsMultipart::BEGIN@10
0000s0sHTTP::Body::XFormsMultipart::::handlerHTTP::Body::XFormsMultipart::handler
0000s0sHTTP::Body::XFormsMultipart::::initHTTP::Body::XFormsMultipart::init
0000s0sHTTP::Body::XFormsMultipart::::startHTTP::Body::XFormsMultipart::start
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package HTTP::Body::XFormsMultipart;
2{
32800ns $HTTP::Body::XFormsMultipart::VERSION = '1.19';
4}
5
6224µs233µs
# spent 21µs (9+12) within HTTP::Body::XFormsMultipart::BEGIN@6 which was called: # once (9µs+12µs) by Plack::Request::BEGIN@10 at line 6
use strict;
# spent 21µs making 1 call to HTTP::Body::XFormsMultipart::BEGIN@6 # spent 12µs making 1 call to strict::import
7224µs2124µs
# spent 66µs (8+58) within HTTP::Body::XFormsMultipart::BEGIN@7 which was called: # once (8µs+58µs) by Plack::Request::BEGIN@10 at line 7
use base 'HTTP::Body::MultiPart';
# spent 66µs making 1 call to HTTP::Body::XFormsMultipart::BEGIN@7 # spent 58µs making 1 call to base::import
8218µs210µs
# spent 9µs (8+1) within HTTP::Body::XFormsMultipart::BEGIN@8 which was called: # once (8µs+1µs) by Plack::Request::BEGIN@10 at line 8
use bytes;
# spent 9µs making 1 call to HTTP::Body::XFormsMultipart::BEGIN@8 # spent 1µs making 1 call to bytes::import
9
10225µs2226µs
# spent 117µs (7+110) within HTTP::Body::XFormsMultipart::BEGIN@10 which was called: # once (7µs+110µs) by Plack::Request::BEGIN@10 at line 10
use IO::File;
# spent 117µs making 1 call to HTTP::Body::XFormsMultipart::BEGIN@10 # spent 110µs making 1 call to Exporter::import
113235µs3146µs
# spent 79µs (12+67) within HTTP::Body::XFormsMultipart::BEGIN@11 which was called: # once (12µs+67µs) by Plack::Request::BEGIN@10 at line 11
use File::Temp 0.14;
# spent 79µs making 1 call to HTTP::Body::XFormsMultipart::BEGIN@11 # spent 57µs making 1 call to Exporter::import # spent 10µs making 1 call to UNIVERSAL::VERSION
12
13=head1 NAME
14
15HTTP::Body::XFormsMultipart - HTTP Body XForms multipart/related submission Parser
16
17=head1 SYNOPSIS
18
19 use HTTP::Body::XForms;
20
21=head1 DESCRIPTION
22
23HTTP Body XForms submission Parser. Inherits HTTP::Body::MultiPart.
24
25This body type is used to parse XForms submission. In this case, the
26XML part that contains the model is indicated by the start attribute
27in the content-type. The XML content is stored unparsed on the
28parameter XForms:Model.
29
30=head1 METHODS
31
32=over 4
33
34=item init
35
36This function is overridden to detect the start part of the
37multipart/related post.
38
39=cut
40
41sub init {
42 my $self = shift;
43 $self->SUPER::init(@_);
44 unless ( $self->content_type =~ /start=\"?\<?([^\"\>;,]+)\>?\"?/ ) {
45 my $content_type = $self->content_type;
46 Carp::croak( "Invalid boundary in content_type: '$content_type'" );
47 }
48
49 $self->{start} = $1;
50
51 return $self;
52}
53
54=item start
55
56Defines the start part of the multipart/related body.
57
58=cut
59
60sub start {
61 return shift->{start};
62}
63
64=item handler
65
66This function is overridden to differ the start part, which should be
67set as the XForms:Model param if its content type is application/xml.
68
69=cut
70
71sub handler {
72 my ( $self, $part ) = @_;
73
74 my $contentid = $part->{headers}{'Content-ID'};
75 $contentid =~ s/^.*[\<\"]//;
76 $contentid =~ s/[\>\"].*$//;
77
78 if ( $contentid eq $self->start ) {
79 $part->{name} = 'XForms:Model';
80 if ($part->{done}) {
81 $self->body($part->{data});
82 }
83 }
84 elsif ( defined $contentid ) {
85 $part->{name} = $contentid;
86 $part->{filename} = $contentid;
87 }
88
89 return $self->SUPER::handler($part);
90}
91
92=back
93
94=head1 AUTHOR
95
96Daniel Ruoso C<daniel@ruoso.com>
97
98=head1 LICENSE
99
100This library is free software . You can redistribute it and/or modify
101it under the same terms as perl itself.
102
103=cut
104
10512µs1;