| 1 | # | ||
| 2 | # This file is part of App-Magpie | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2011 by Jerome Quelin. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | 13 | ▶ | use 5.012; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 13 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 13 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | package App::Magpie::App::Command; | ||
| 14 | # ABSTRACT: base class for sub-commands | ||
| 15 | 13 | $App::Magpie::App::Command::VERSION = '2.010'; | |
| 16 | 13 | ▶ | use App::Cmd::Setup -command; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 13 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 13 | ▶ | use MooseX::Has::Sugar; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | |||
| 20 | 13 | ▶ | use App::Magpie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 13 | ▶ | use App::Magpie::Logger; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | |||
| 24 | # -- public attributes | ||
| 25 | |||
| 26 | |||
| 27 | has magpie => ( | ||
| 28 | ro, lazy, | ||
| 29 | isa => "App::Magpie", | ||
| 30 | 0 | ▶ | default => sub { App::Magpie->new; } |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 31 | 13 | ); | |
| 32 | |||
| 33 | |||
| 34 | # -- public methods | ||
| 35 | |||
| 36 | |||
| 37 | 0 | ▶ | sub log_init { |
|
Subroutine
log_init: not called CC=3 SCAR=24.8
Pod
documented
| |||
| 38 | 0 | my ($self, $opts) = @_; | |
| 39 | |||
| 40 | 0 | my $logger =App::Magpie::Logger->instance; | |
| 41 | 0 | $logger->more_verbose for 0 .. $opts->{verbose}; | |
| 42 | 0 | $logger->less_verbose for 0 .. $opts->{quiet}; | |
| 43 | } | ||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | 0 | ▶ | sub verbose_options { |
|
Subroutine
verbose_options: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 48 | 0 | my $logger = App::Magpie::Logger->instance; | |
| 49 | 0 | my $log_level = ( qw{ quiet normal debug } )[ $logger->log_level ]; | |
| 50 | return ( | ||
| 51 | 0 | [ "Logging options (default log level: $log_level)" ], | |
| 52 | [ 'verbose|v+' => "be more verbose (can be repeated)", {default=>0} ], | ||
| 53 | [ 'quiet|q+' => "be less versbose (can be repeated)", {default=>0} ], | ||
| 54 | ); | ||
| 55 | } | ||
| 56 | |||
| 57 | 13 | 1; | |
| 58 | |||
| 59 | __END__ | ||