Engine/Request/Upload.pm

filter: Statementstmt 36.8% 14 / 38 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 100% 3 / 3 totaltotal 35.1% 19 / 54 SCAR 22.1
CC
4
Cov
32%
slurp
12.0
__ANON__
6.0
__ANON__
2.0
CRAP 9.1
« Engine/Role/ResponseWriter/OutputBody.pm ↑ Summary Engine/Types/Core.pm »
1 package HTTP::Engine::Request::Upload;
2 1 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 has filename => (
4 is => 'ro',
5 );
6 1 has headers => (
7 is => 'ro',
8 handles => {
9 type => 'content_type'
10 },
11 );
12 1 has size => (
13 is => 'ro',
14 );
15 1 has tempname => (
16 is => 'ro',
17 );
18 has basename => (
19 is => 'ro',
20 lazy => 1,
21 default => sub {
22 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 require File::Spec::Unix;
24 0 my $basename = $self->filename;
25 0 $basename =~ s|\\|/|g;
26 0 $basename = ( File::Spec::Unix->splitpath($basename) )[2];
27 0 $basename =~ s|[^\w\.-]+|_|g;
28 0 $basename;
29 }
30 1 );
31  
32 has fh => (
33 is => 'ro',
34 lazy => 1,
35 default => sub {
36 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
37  
38 0 ▶ open my $fh, '<', $self->tempname or die "Can't open '@{[ $self->tempname ]}': '$!'";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $self->tempname or die "Can't open '@{[$self->tempname];}': '$!'" 0 0 0
39 0 return $fh;
40 },
41 1 );
42  
43 sub copy_to {
44 0 ▶ my $self = shift;
Subroutine copy_to: not called CC=1 SCAR=6.9
Pod documented
45 0 require File::Copy;
46 0 File::Copy::copy( $self->tempname, @_ );
47 }
48  
49 sub link_to {
50 0 ▶ my ( $self, $target ) = @_;
Subroutine link_to: not called CC=1 SCAR=6.9
Pod documented
51 0 CORE::link( $self->tempname, $target );
52 }
53  
54 sub slurp {
55 0 ▶ my ( $self, $layer ) = @_;
Subroutine slurp: not called CC=3 SCAR=24.8
Pod documented
56  
57 0 ▶ $layer = ':raw' unless $layer;
Branch: 1 branch
BranchTrueFalseTotal
unless $layer 0 0 0
58  
59 0 my $content = undef;
60 0 my $handle = $self->fh;
61  
62 0 binmode( $handle, $layer );
63  
64 0 ▶ while ( $handle->read( my $buffer, 8192 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($handle->read(my $buffer, 8192)) 0 0 0
65 0 $content .= $buffer;
66 }
67  
68 0 $content;
69 }
70  
71 1 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 1 __PACKAGE__->meta->make_immutable(inline_destructor => 1);
73 1 1;
74 __END__
« Engine/Role/ResponseWriter/OutputBody.pm ↑ Summary Engine/Types/Core.pm »