Body/OctetStream.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 37 / 37 CC 5 SCAR 11.7
CC
5
Cov
100%
spin
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« Body/UrlEncoded.pm ↑ Summary Body/XFormsMultipart.pm »
1 package HTTP::Body::OctetStream;
2 24 $HTTP::Body::OctetStream::VERSION = '1.24_01'; # TRIAL
3 24 $HTTP::Body::OctetStream::VERSION = '1.2401';
4 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 24 ▶use base 'HTTP::Body';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 24 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 24 ▶use File::Temp 0.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 HTTP::Body::OctetStream - HTTP Body OctetStream Parser
13  
14 =head1 SYNOPSIS
15  
16 use HTTP::Body::OctetStream;
17  
18 =head1 DESCRIPTION
19  
20 HTTP Body OctetStream Parser.
21  
22 =head1 METHODS
23  
24 =over 4
25  
26 =item spin
27  
28 =cut
29  
30 21 ▶sub spin {
Subroutine spin: called CC=5 SCAR=16.1
Pod documented
31 21 my $self = shift;
32  
33 21 ▶ unless ( $self->body ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->body) 5 16 21
34 5 $self->body( File::Temp->new( DIR => $self->tmpdir ) );
35 }
36  
37 21 ▶ if ( my $length = length( $self->{buffer} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $length = length $self->{"buffer"}) 20 1 21
38 20 ▶ $self->body->write( substr( $self->{buffer}, 0, $length, '' ), $length )
Branch: 1 branch
BranchTrueFalseTotal
$self->body->write(substr($self->{"buffer"}, 0, $length, ""), $length) or Carp::croak("Can't write to temporary file: $!") 19 1 20
39 or Carp::croak("Can't write to temporary file: $!");
40 }
41  
42 20 ▶ if ( $self->length == $self->content_length ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->length == $self->content_length) 3 17 20
43 3 seek( $self->body, 0, 0 );
44 3 $self->state('done');
45 }
46 }
47  
48 =back
49  
50 =head1 SUPPORT
51  
52 See L<HTTP::Body>
53  
54 =head1 AUTHOR
55  
56 Christian Hansen, C<ch@ngmedia.com>
57  
58 =head1 LICENSE
59  
60 This library is free software . You can redistribute it and/or modify
61 it under the same terms as perl itself.
62  
63 =cut
64  
65 24 1;
« Body/UrlEncoded.pm ↑ Summary Body/XFormsMultipart.pm »