| 1 | package Sys::Bprsync::Cmd::Command; | ||
| 2 | { | ||
| 3 | 1 | $Sys::Bprsync::Cmd::Command::VERSION = '0.25'; | |
| 4 | } | ||
| 5 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | $Sys::Bprsync::Cmd::Command::AUTHORITY = 'cpan:TEX'; | |
| 7 | } | ||
| 8 | # ABSTRACT: baseclass for any bprsync 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 | |||
| 26 | # extends ... | ||
| 27 | 1 | extends 'MooseX::App::Cmd::Command'; | |
| 28 | # has ... | ||
| 29 | 1 | has '_config' => ( | |
| 30 | 'is' => 'rw', | ||
| 31 | 'isa' => 'Config::Yak', | ||
| 32 | 'lazy' => 1, | ||
| 33 | 'builder' => '_init_config', | ||
| 34 | 'accessor' => 'config', | ||
| 35 | ); | ||
| 36 | |||
| 37 | 1 | has '_logger' => ( | |
| 38 | 'is' => 'rw', | ||
| 39 | 'isa' => 'Log::Tree', | ||
| 40 | 'lazy' => 1, | ||
| 41 | 'builder' => '_init_logger', | ||
| 42 | 'accessor' => 'logger', | ||
| 43 | ); | ||
| 44 | # with ... | ||
| 45 | # initializers ... | ||
| 46 | 0 | ▶ | sub _init_config { |
|
Subroutine
_init_config: not called CC=1 SCAR=6.9
| |||
| 47 | 0 | my $self = shift; | |
| 48 | |||
| 49 | 0 | my $Config = Config::Yak::->new({ | |
| 50 | 'locations' => [qw(conf /etc/bprsync)], | ||
| 51 | }); | ||
| 52 | |||
| 53 | 0 | return $Config; | |
| 54 | } | ||
| 55 | |||
| 56 | 0 | ▶ | sub _init_logger { |
|
Subroutine
_init_logger: not called CC=1 SCAR=6.9
| |||
| 57 | 0 | my $self = shift; | |
| 58 | |||
| 59 | 0 | my $Logger = Log::Tree::->new('bprsync'); | |
| 60 | |||
| 61 | 0 | return $Logger; | |
| 62 | } | ||
| 63 | |||
| 64 | # your code here ... | ||
| 65 | |||
| 66 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 67 | 1 | __PACKAGE__->meta->make_immutable; | |
| 68 | |||
| 69 | 1 | 1; | |
| 70 | |||
| 71 | __END__ | ||