Class.pm

filter: Statementstmt 86.6% 26 / 30 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 85.7% 6 / 7 Podpod 100% 3 / 3 totaltotal 83.7% 36 / 43 CC 2 SCAR 3.5
CC
2
Cov
84%
TRACE
2.1
table
2.0
BEGIN
1.0
CRAP 1.4
« Class/Abstract/Stats.pm ↑ Summary Class/Abstract/Filter.pm »
1 package Monitoring::Livestatus::Class;
2  
3 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use Module::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Class::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 our $VERSION = '0.06';
8  
9 19 ▶sub TRACE { return $ENV{'MONITORING_LIVESTATUS_CLASS_TRACE'} || 0 };
Subroutine TRACE: called CC=2 SCAR=7.6
Pod documented
Condition50%1/2
$ENV{'MONITORING_LIVESTATUS_CLASS_TRACE'} || 0
l!l
019
MC/DC0%0/1
$ENV{'MONITORING_LIVESTATUS_CLASS_TRACE'} || 0
$ENV{'MONITORING_LIVESTATUS_CLASS_TRACE'}
Truth table50%1/2
A
A= $ENV{'MONITORING_LIVESTATUS_CLASS_TRACE'}
Aresult
11
00
10 6 our $TRACE = TRACE();
11  
12 6 has 'peer' => (
13 is => 'rw',
14 required => 1,
15 );
16  
17 6 has 'verbose' => (
18 is => 'rw',
19 isa => 'Bool',
20 required => 0,
21 );
22  
23 6 has 'keepalive' => (
24 is => 'rw',
25 isa => 'Bool',
26 required => 0,
27 );
28  
29 6 has 'name' => (
30 is => 'rw',
31 isa => 'Str',
32 required => 0,
33 );
34  
35  
36 6 has 'backend_obj' => (
37 is => 'ro',
38 );
39  
40 6 has 'table_sources' => (
41 is => 'ro',
42 # isa => 'ArrayRef',
43 builder => '_build_table_sources',
44 );
45  
46 5 ▶sub _build_table_sources {
Subroutine _build_table_sources: called CC=1 SCAR=0.0
47 5 my $self = shift;
48 5 my @found = useall Monitoring::Livestatus::Class::Table;
49 5 return \@found;
50 }
51  
52 5 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
53 5 my $self = shift;
54  
55 5 my $backend = sprintf 'Monitoring::Livestatus';
56 5 Class::Load::load_class($backend);
57 $self->{backend_obj} = $backend->new(
58 name => $self->{name},
59 peer => $self->{peer},
60 keepalive => $self->{keepalive},
61 verbose => $self->{verbose},
62 5 );
63 }
64  
65  
66  
67 0 ▶sub table {
Subroutine table: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 my $table = ucfirst(lc(shift));
70 0 my $class = sprintf("Monitoring::Livestatus::Class::Table::%s",$table);
71 0 return $class->new( ctx => $self );
72 }
73  
74 6 1;
75 __END__
« Class/Abstract/Stats.pm ↑ Summary Class/Abstract/Filter.pm »