lib/Monitoring/Spooler/Cmd/Command.pm untested

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