| 1 | package Log::Log4perl::Appender::String; | ||||||||||||||||||||
| 2 | 54 | our @ISA = qw(Log::Log4perl::Appender); | |||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | ################################################## | ||||||||||||||||||||
| 5 | # Log dispatcher writing to a string buffer | ||||||||||||||||||||
| 6 | ################################################## | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | ################################################## | ||||||||||||||||||||
| 9 | 54 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||
| 10 | ################################################## | ||||||||||||||||||||
| 11 | 54 | my $proto = shift; | |||||||||||||||||||
| 12 | 54 | ▶ | my $class = ref $proto || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 13 | 54 | my %params = @_; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 54 | my $self = { | |||||||||||||||||||
| 16 | name => "unknown name", | ||||||||||||||||||||
| 17 | string => "", | ||||||||||||||||||||
| 18 | %params, | ||||||||||||||||||||
| 19 | }; | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 54 | bless $self, $class; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | ################################################## | ||||||||||||||||||||
| 25 | 0 | ▶ | sub log { | ||||||||||||||||||
|
Subroutine
log: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 26 | ################################################## | ||||||||||||||||||||
| 27 | 0 | my $self = shift; | |||||||||||||||||||
| 28 | 0 | my %params = @_; | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | $self->{string} .= $params{message}; | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | ################################################## | ||||||||||||||||||||
| 34 | 0 | ▶ | sub string { | ||||||||||||||||||
|
Subroutine
string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 35 | ################################################## | ||||||||||||||||||||
| 36 | 0 | my($self, $new) = @_; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | if(defined $new) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | 0 | $self->{string} = $new; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | return $self->{string}; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 54 | 1; | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||