POE/Component/Server/Twirc/LogAppender.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 33.3% 1 / 3 totaltotal 38.4% 15 / 39 CC 5 SCAR 18.4
CC
5
Cov
37%
new
12.0
log
6.0
dump_history
6.0
CRAP 6.3
« POE/Component/Server/Twirc.pm ↑ Summary App/Twirc/Plugin/SecondaryAccount.pm »
1 package POE::Component::Server::Twirc::LogAppender;
2 2 $POE::Component::Server::Twirc::LogAppender::VERSION = '0.20';
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base qw/Log::Log4perl::Appender/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
9 0 my($class, @options) = @_;
10  
11 0 my $self = {
12 name => 'twirc-logger',
13 irc_channel => '&twirc-log',
14 history => [],
15 history_size => 50,
16 @options,
17 };
18  
19 0 for ( qw/ircd irc_botname irc_channel/ ) {
20 0 ▶ die "$_ required" unless defined $self->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$_} 0 0 0
21 }
22  
23 0 bless $self, $class;
24 }
25  
26 0 ▶sub log {
Subroutine log: not called CC=2 SCAR=17.9
Pod undocumented
27 0 my($self, %params) = @_;
28  
29 $self->{ircd}->yield(daemon_cmd_privmsg =>
30 0 $self->{irc_botname}, $self->{irc_channel}, $params{message});
31  
32 0 push @{$self->{history}}, \%params;
33 0 ▶ shift @{$self->{history}} while @{$self->{history}} > $self->{history_size};
Branch: 1 branch
BranchTrueFalseTotal
@{$self->{"history"};} > $self->{"history_size"} and do { shift @{$$self{"history"};} } 0 0 0
34 }
35  
36 0 ▶sub dump_history {
Subroutine dump_history: not called CC=2 SCAR=17.9
Pod undocumented
37 0 my $self = shift;
38  
39 $self->{ircd}->yield(daemon_cmd_privmsg =>
40 $self->{irc_botname}, $self->{irc_channel}, $_->{message})
41 0 for @{$self->{history}};
42 }
43  
44 2 1;
« POE/Component/Server/Twirc.pm ↑ Summary App/Twirc/Plugin/SecondaryAccount.pm »