blib/lib/Net/FSP/Handle/Write.pm

filter: Statementstmt 40.0% 14 / 35 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 4 / 12 Podpod n/a totaltotal 33.9% 18 / 53 SCAR 21.5
CC
4
Cov
34%
OPEN
6.0
PRINT
6.0
__ANON__
6.0
CRAP 8.6
« blib/lib/Net/FSP/Handle.pm ↑ Summary blib/lib/Net/FSP/File.pm »
1 package Net::FSP::Handle::Write;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 our $VERSION = $Net::FSP::VERSION;
5 2 ▶use Net::FSP::Handle qw/do_or_fail/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base 'Net::FSP::Handle';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub OPEN {
9 0 ▶ my ($self, $mode, $filename) = @_;
Subroutine OPEN: not called CC=2 SCAR=17.9
10 0 ▶ $self->CLOSE if keys %{$self} > 1;
Branch: 1 branch
BranchTrueFalseTotal
if keys %{$self;} > 1 0 0 0
11 0 $self->{writer} = $self->{fsp}->_get_writer($filename);
12 0 return $self;
13 }
14  
15 sub PRINT {
16 0 ▶ my ($self, @args) = @_;
Subroutine PRINT: not called CC=2 SCAR=17.9
17 0 ▶ my $separator = defined $, ? $, : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $, ? : 0 0 0
18 0 my $buffer = join $separator, @args;
19 0 return $self->WRITE($buffer, length $buffer, 0);
20 }
21  
22 sub PRINTF {
23 0 ▶ my ($self, @args) = @_;
Subroutine PRINTF: not called CC=1 SCAR=6.9
24 0 my $buffer = sprintf shift, @args;
25 0 return $self->WRITE($buffer, length $buffer, 0);
26 }
27  
28 sub WRITE {
29 0 ▶ my ($self, $buffer, $length, $offset) = @_;
Subroutine WRITE: not called CC=1 SCAR=6.9
30 return do_or_fail {
31 0 ▶ $self->{writer}->(substr $buffer, $offset, $length);
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 };
33 }
34  
35 sub EOF {
36 0 ▶ return 0;
Subroutine EOF: not called CC=1 SCAR=6.9
37 }
38  
39 sub CLOSE {
40 0 ▶ my $self = shift;
Subroutine CLOSE: not called CC=1 SCAR=6.9
41  
42 my $ret = do_or_fail {
43 0 ▶ $self->{writer}->(undef) if defined $self->{writer};
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"writer"} 0 0 0
44 0 };
45 0 $self->SUPER::CLOSE;
46 0 return $ret;
47 }
48  
49 2 1;
50  
51 __END__
« blib/lib/Net/FSP/Handle.pm ↑ Summary blib/lib/Net/FSP/File.pm »