blib/lib/String/Buffer.pm

filter: Statementstmt 37.0% 10 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 28.5% 2 / 7 Podpod 100% 5 / 5 totaltotal 36.9% 17 / 46 CC 3 SCAR 16.3
CC
3
Cov
31%
new
12.0
write
2.0
writeln
2.0
CRAP 5.1
↑ Summary
1 package String::Buffer;
2  
3 # Copyright 2001 by Steve McKay. All rights reserved.
4 # This library is free software; you can redistribute it and/or
5 # modify it under the same terms as Perl itself.
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use vars qw( @ISA $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 $VERSION = 0.05;
10  
11 1 *append = \&write;
12 1 *appendln = \&writeln;
13  
14 sub new
15 0 ▶{
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
16 0 my ( $proto, $str ) = @_;
17 0 ▶ my $class = ref( $proto ) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
18 0 my $self = {
19 buffer => undef,
20 };
21 0 ▶ $self->{buffer} = $str if $str;
Branch: 1 branch
BranchTrueFalseTotal
if $str 0 0 0
22 0 bless( $self, $class );
23 0 return $self;
24 }
25  
26 sub write
27 0 ▶{
Subroutine write: not called CC=1 SCAR=6.9
Pod documented
28 0 my( $self, @val ) = @_;
29 0 $self->{buffer} .= join( '', @val );
30 0 return undef;
31 }
32  
33 sub writeln
34 0 ▶{
Subroutine writeln: not called CC=1 SCAR=6.9
Pod documented
35 0 my( $self, @val ) = @_;
36 0 return $self->write( @val, "\n" );
37 }
38  
39 sub read
40 0 ▶{
Subroutine read: not called CC=1 SCAR=6.9
Pod documented
41 0 my( $self ) = @_;
42 0 return $self->{buffer};
43 }
44  
45 sub flush
46 0 ▶{
Subroutine flush: not called CC=1 SCAR=6.9
Pod documented
47 0 my( $self ) = @_;
48 0 my $flushed = $self->read();
49 0 $self->{buffer} = undef;
50 0 return $flushed;
51 }
52  
53 1 1;
54  
55 __END__
↑ Summary