| 1 | # ABSTRACT: Base class for interactive interfaces | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | package Pinto::Chrome; | ||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | 64 | ▶ | use Moose; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | 64 | ▶ | use MooseX::StrictConstructor; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 7 | 64 | ▶ | use MooseX::Types::Moose qw(Int Bool); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | 64 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | 64 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 15 | |||||||||||||||||||||||
| 16 | 64 | has verbose => ( | |||||||||||||||||||||
| 17 | is => 'ro', | ||||||||||||||||||||||
| 18 | isa => Int, | ||||||||||||||||||||||
| 19 | default => 0, | ||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||
| 21 | |||||||||||||||||||||||
| 22 | 64 | has quiet => ( | |||||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||||
| 24 | isa => Bool, | ||||||||||||||||||||||
| 25 | default => 0, | ||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||
| 27 | |||||||||||||||||||||||
| 28 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 29 | |||||||||||||||||||||||
| 30 | 0 | ▶ | sub show { return 1 } | ||||||||||||||||||||
|
Subroutine
show: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 31 | |||||||||||||||||||||||
| 32 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 33 | |||||||||||||||||||||||
| 34 | 0 | ▶ | sub diag { return 1 } | ||||||||||||||||||||
|
Subroutine
diag: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 35 | |||||||||||||||||||||||
| 36 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | 0 | ▶ | sub edit { return $_[1] } | ||||||||||||||||||||
|
Subroutine
edit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 39 | |||||||||||||||||||||||
| 40 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 0 | ▶ | sub show_progress { return 1 } | ||||||||||||||||||||
|
Subroutine
show_progress: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 45 | |||||||||||||||||||||||
| 46 | 0 | ▶ | sub progress_done { return 1 } | ||||||||||||||||||||
|
Subroutine
progress_done: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 47 | |||||||||||||||||||||||
| 48 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 49 | |||||||||||||||||||||||
| 50 | 259 | ▶ | sub should_render_diag { | ||||||||||||||||||||
|
Subroutine
should_render_diag: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||
| 51 | 259 | my ( $self, $level ) = @_; | |||||||||||||||||||||
| 52 | |||||||||||||||||||||||
| 53 | 259 | ▶ | return 1 if $level == 0; # Always, always display errors | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 54 | 171 | ▶ | return 0 if $self->quiet; # Don't display anything else if quiet | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 55 | 168 | ▶ | return 1 if $self->verbose + 1 >= $level; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 56 | 9 | return 0; | |||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||
| 58 | |||||||||||||||||||||||
| 59 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 60 | |||||||||||||||||||||||
| 61 | 64 | ▶ | sub diag_levels { return qw(error warning notice info) } | ||||||||||||||||||||
|
Subroutine
diag_levels: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 62 | |||||||||||||||||||||||
| 63 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 64 | |||||||||||||||||||||||
| 65 | 64 | my @levels = __PACKAGE__->diag_levels; | |||||||||||||||||||||
| 66 | 64 | __generate_diag_method( $levels[$_], $_ ) for ( 0 .. $#levels ); | |||||||||||||||||||||
| 67 | |||||||||||||||||||||||
| 68 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 69 | |||||||||||||||||||||||
| 70 | 256 | ▶ | sub __generate_diag_method { | ||||||||||||||||||||
|
Subroutine
__generate_diag_method: called CC=2 SCAR=7.0
| |||||||||||||||||||||||
| 71 | 256 | my ( $method_name, $diag_level ) = @_; | |||||||||||||||||||||
| 72 | |||||||||||||||||||||||
| 73 | 256 | my $template = <<'END_METHOD'; | |||||||||||||||||||||
| 74 | sub %s { | ||||||||||||||||||||||
| 75 | my ($self, $msg, $opts) = @_; | ||||||||||||||||||||||
| 76 | return unless $self->should_render_diag(%s); | ||||||||||||||||||||||
| 77 | $self->diag($msg, $opts); | ||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||
| 79 | END_METHOD | ||||||||||||||||||||||
| 80 | |||||||||||||||||||||||
| 81 | 256 | ▶ | eval sprintf $template, $method_name, $diag_level; | ||||||||||||||||||||
|
Subroutine
error: called CC=2 SCAR=6.9
Subroutine
info: called CC=2 SCAR=6.9
Subroutine
notice: called CC=2 SCAR=6.9
Subroutine
warning: called CC=2 SCAR=6.9
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Branch: 4 branches
| |||||||||||||||||||||||
| 82 | 256 | ▶ | croak $@ if $@; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||
| 84 | |||||||||||||||||||||||
| 85 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 86 | |||||||||||||||||||||||
| 87 | 64 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||
| 88 | |||||||||||||||||||||||
| 89 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 90 | 64 | 1; | |||||||||||||||||||||
| 91 | |||||||||||||||||||||||
| 92 | __END__ | ||||||||||||||||||||||