| Filename | /usr/local/share/perl/5.18.2/HTTP/Body/OctetStream.pm |
| Statements | Executed 12 statements in 411µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 180µs | 182µs | HTTP::Body::OctetStream::BEGIN@8 |
| 1 | 1 | 1 | 26µs | 140µs | HTTP::Body::OctetStream::BEGIN@10 |
| 1 | 1 | 1 | 14µs | 32µs | HTTP::Body::OctetStream::BEGIN@6 |
| 1 | 1 | 1 | 8µs | 86µs | HTTP::Body::OctetStream::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | HTTP::Body::OctetStream::spin |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package HTTP::Body::OctetStream; | ||||
| 2 | { | ||||
| 3 | 2 | 1µs | $HTTP::Body::OctetStream::VERSION = '1.19'; | ||
| 4 | } | ||||
| 5 | |||||
| 6 | 2 | 27µs | 2 | 50µs | # spent 32µs (14+18) within HTTP::Body::OctetStream::BEGIN@6 which was called:
# once (14µs+18µs) by Plack::Request::BEGIN@10 at line 6 # spent 32µs making 1 call to HTTP::Body::OctetStream::BEGIN@6
# spent 18µs making 1 call to strict::import |
| 7 | 2 | 28µs | 2 | 164µs | # spent 86µs (8+78) within HTTP::Body::OctetStream::BEGIN@7 which was called:
# once (8µs+78µs) by Plack::Request::BEGIN@10 at line 7 # spent 86µs making 1 call to HTTP::Body::OctetStream::BEGIN@7
# spent 78µs making 1 call to base::import |
| 8 | 2 | 198µs | 2 | 184µs | # spent 182µs (180+2) within HTTP::Body::OctetStream::BEGIN@8 which was called:
# once (180µs+2µs) by Plack::Request::BEGIN@10 at line 8 # spent 182µs making 1 call to HTTP::Body::OctetStream::BEGIN@8
# spent 2µs making 1 call to bytes::import |
| 9 | |||||
| 10 | 3 | 155µs | 3 | 254µs | # spent 140µs (26+114) within HTTP::Body::OctetStream::BEGIN@10 which was called:
# once (26µs+114µs) by Plack::Request::BEGIN@10 at line 10 # spent 140µs making 1 call to HTTP::Body::OctetStream::BEGIN@10
# spent 101µs making 1 call to Exporter::import
# spent 13µs making 1 call to UNIVERSAL::VERSION |
| 11 | |||||
| 12 | =head1 NAME | ||||
| 13 | |||||
| 14 | HTTP::Body::OctetStream - HTTP Body OctetStream Parser | ||||
| 15 | |||||
| 16 | =head1 SYNOPSIS | ||||
| 17 | |||||
| 18 | use HTTP::Body::OctetStream; | ||||
| 19 | |||||
| 20 | =head1 DESCRIPTION | ||||
| 21 | |||||
| 22 | HTTP Body OctetStream Parser. | ||||
| 23 | |||||
| 24 | =head1 METHODS | ||||
| 25 | |||||
| 26 | =over 4 | ||||
| 27 | |||||
| 28 | =item spin | ||||
| 29 | |||||
| 30 | =cut | ||||
| 31 | |||||
| 32 | sub spin { | ||||
| 33 | my $self = shift; | ||||
| 34 | |||||
| 35 | unless ( $self->body ) { | ||||
| 36 | $self->body( File::Temp->new( DIR => $self->tmpdir ) ); | ||||
| 37 | } | ||||
| 38 | |||||
| 39 | if ( my $length = length( $self->{buffer} ) ) { | ||||
| 40 | $self->body->write( substr( $self->{buffer}, 0, $length, '' ), $length ); | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | if ( $self->length == $self->content_length ) { | ||||
| 44 | seek( $self->body, 0, 0 ); | ||||
| 45 | $self->state('done'); | ||||
| 46 | } | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | =back | ||||
| 50 | |||||
| 51 | =head1 AUTHOR | ||||
| 52 | |||||
| 53 | Christian Hansen, C<ch@ngmedia.com> | ||||
| 54 | |||||
| 55 | =head1 LICENSE | ||||
| 56 | |||||
| 57 | This library is free software . You can redistribute it and/or modify | ||||
| 58 | it under the same terms as perl itself. | ||||
| 59 | |||||
| 60 | =cut | ||||
| 61 | |||||
| 62 | 1 | 2µs | 1; |