blib/lib/App/Metabase/Relayd/Plugin/Dumper.pm

filter: Statementstmt 35.9% 14 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 2 totaltotal 29.5% 18 / 61 CC 6 SCAR 26.2
CC
6
Cov
28%
init
30.0
mbrd_received
4.5
_start
2.0
CRAP 13.7
↑ Summary
1 package App::Metabase::Relayd::Plugin::Dumper;
2 1 $App::Metabase::Relayd::Plugin::Dumper::VERSION = '0.04';
3 # ABSTRACT: Dumper plugin for metabase-relayd
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub init {
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
10 0 my $package = shift;
11 0 my $config = shift;
12 0 ▶ return unless $config and ref $config eq 'Config::Tiny';
Branch: 1 branch
BranchTrueFalseTotal
unless $config and ref $config eq "Config::Tiny" 0 0 0
Condition0%0/3
$config and ref $config eq "Config::Tiny"
!ll&&!rl&&r
000
MC/DC0%0/2
$config and ref $config eq "Config::Tiny"
$config ref $config eq "Config::Tiny"
Truth table0%0/3
A and B
A= $configB= ref $config eq "Config::Tiny"
ABresult
0X0
100
111
13 0 ▶ return unless $config->{Dumper};
Branch: 1 branch
BranchTrueFalseTotal
unless $config->{"Dumper"} 0 0 0
14 0 ▶ return unless $config->{Dumper}->{enable};
Branch: 1 branch
BranchTrueFalseTotal
unless $config->{"Dumper"}{"enable"} 0 0 0
15 0 my $heap = $config->{Dumper};
16 0 POE::Session->create(
17 package_states => [
18 __PACKAGE__, [qw(_start mbrd_received)],
19 ],
20 heap => $heap,
21 );
22 }
23  
24 0 ▶sub _start {
Subroutine _start: not called CC=1 SCAR=6.9
25 0 my ($kernel,$heap) = @_[KERNEL,HEAP];
26 0 $kernel->refcount_increment( $_[SESSION]->ID(), __PACKAGE__ );
27 0 return;
28 }
29  
30 0 ▶sub mbrd_received {
Subroutine mbrd_received: not called CC=2 SCAR=14.9
Pod undocumented
31 0 my ($kernel,$heap,$data,$ip) = @_[KERNEL,HEAP,ARG0,ARG1];
32 1 ▶ use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 0 my $stamp = '[ ';
34 {
35 0 my $t = localtime;
36 0 $stamp .= join ' ', $ip, $t->strftime("%Y-%m-%dT%H:%M:%S");
37 }
38 0 $stamp .= ' ]';
39 0 my $t = localtime; my $ts = $t->strftime("%Y-%m-%dT%H%M%S");
40 0 my $msg = join(' ', uc($data->{grade}), ( map { $data->{$_} } qw(distfile archname osversion) ), "perl-" . $data->{perl_version}, $stamp );
41 0 ▶ open my $file, '>', $ts or die "$!\n";
Branch: 1 branch
BranchTrueFalseTotal
open my $file, ">", $ts or die "$!\n" 0 0 0
42 0 print {$file} "$msg\n$data->{textreport}\n";
43 0 close $file;
44 0 return;
45 }
46  
47  
48 1 qq[Smokey Dumps];
49  
50 __END__
↑ Summary