lib/Zabbix/Reporter/Cmd/Command.pm

filter: Statementstmt 79.5% 35 / 44 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 76.9% 10 / 13 Podpod n/a totaltotal 78.9% 45 / 57 CC 1 SCAR 2.1
CC
1
Cov
80%
_init_config
2.0
_init_logger
2.0
_init_zr
2.0
CRAP 1.2
« script/zreporter.pl ↑ Summary lib/Zabbix/Reporter/Cmd/Command/list.pm »
1 package Zabbix::Reporter::Cmd::Command;
2 {
3 1 $Zabbix::Reporter::Cmd::Command::VERSION = '0.07';
4 }
5 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $Zabbix::Reporter::Cmd::Command::AUTHORITY = 'cpan:TEX';
7 }
8 # ABSTRACT: baseclass for any CLI command
9  
10 1 ▶use 5.010_000;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use feature ':5.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # use IO::Handle;
18 # use autodie;
19 # use MooseX::Params::Validate;
20 # use Carp;
21 # use English qw( -no_match_vars );
22 # use Try::Tiny;
23 1 ▶use Config::Yak;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Log::Tree;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Zabbix::Reporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 # extends ...
28 1 extends 'MooseX::App::Cmd::Command';
29  
30 # has ...
31 1 has '_config' => (
32 'is' => 'rw',
33 'isa' => 'Config::Yak',
34 'lazy' => 1,
35 'builder' => '_init_config',
36 'accessor' => 'config',
37 );
38  
39 1 has '_logger' => (
40 'is' => 'rw',
41 'isa' => 'Log::Tree',
42 'lazy' => 1,
43 'builder' => '_init_logger',
44 'accessor' => 'logger',
45 );
46  
47 1 has '_zr' => (
48 'is' => 'rw',
49 'isa' => 'Zabbix::Reporter',
50 'lazy' => 1,
51 'builder' => '_init_zr',
52 'accessor' => 'zr',
53 );
54  
55 # with ...
56 # initializers ...
57 0 ▶sub _init_config {
Subroutine _init_config: not called CC=1 SCAR=6.9
58 0 my $self = shift;
59  
60 0 my $Config = Config::Yak::->new( { 'locations' => [qw(conf /etc/zreporter)], } );
61  
62 0 return $Config;
63 } ## end sub _init_config
64  
65 0 ▶sub _init_logger {
Subroutine _init_logger: not called CC=1 SCAR=6.9
66 0 my $self = shift;
67  
68 0 my $Logger = Log::Tree::->new('zreporter');
69  
70 0 return $Logger;
71 } ## end sub _init_logger
72  
73 0 ▶sub _init_zr {
Subroutine _init_zr: not called CC=1 SCAR=6.9
74 0 my $self = shift;
75  
76 0 my $ZR = Zabbix::Reporter::->new(
77 {
78 'config' => $self->config(),
79 'logger' => $self->logger(),
80 }
81 );
82  
83 0 return $ZR;
84 } ## end sub _init_zr
85  
86 # your code here ...
87  
88 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 1 __PACKAGE__->meta->make_immutable;
90  
91 1 1;
92  
93 __END__
« script/zreporter.pl ↑ Summary lib/Zabbix/Reporter/Cmd/Command/list.pm »