| 1 | package Terse::Plugin::Glitch; | ||||||||||||||
| 2 | 1 | ▶ | use 5.006; use strict; use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 1 | our $VERSION = '0.05'; | |||||||||||||
| 4 | 1 | ▶ | use Glitch; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use YAML::XS; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use JSON; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | ▶ | use base 'Terse::Plugin'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 0 | ▶ | sub build_plugin { | ||||||||||||
|
Subroutine
build_plugin: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||
| 10 | 0 | my ($self) = @_; | |||||||||||||
| 11 | 0 | ▶ | $self->build_glitch_config if $self->can('build_glitch_config'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 12 | 0 | ▶ | if (!$self->glitch_config) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 13 | 0 | my $file = $0; | |||||||||||||
| 14 | 0 | ($self->glitch_config = $0) =~ s/(\.psgi)?$/.glitch/; | |||||||||||||
| 15 | } | ||||||||||||||
| 16 | 0 | ▶ | if ($self->{format} eq 'YAML') { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 17 | 0 | ▶ | $self->{glitch_config_parser} = sub { YAML::XS::Load($_[0]) }; | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||
| 18 | } elsif ($self->{format} eq 'JSON') { | ||||||||||||||
| 19 | 0 | ▶ | $self->{glitch_config_parser} = sub { JSON->new->encode($_[0]) }; | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||
| 20 | } | ||||||||||||||
| 21 | Glitch::build_meta( | ||||||||||||||
| 22 | 0 | map {($_, $self->{$_})} grep {$_ !~ m/^(namespace|format|app)$/} keys %{$self} | |||||||||||||
| 23 | ); | ||||||||||||||
| 24 | } | ||||||||||||||
| 25 | |||||||||||||||
| 26 | 0 | ▶ | sub call { | ||||||||||||
|
Subroutine
call: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 27 | 0 | my ($self, $name) = @_; | |||||||||||||
| 28 | 0 | eval { glitch($name) }; | |||||||||||||
| 29 | 0 | return $@; | |||||||||||||
| 30 | } | ||||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | ▶ | sub logError { | ||||||||||||
|
Subroutine
logError: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||
| 33 | 0 | my ($self, $t, $name, $status) = @_; | |||||||||||||
| 34 | 0 | my $glitch = $self->call($name); | |||||||||||||
| 35 | 0 | ▶ | $self->extend($glitch) if $self->can('extend'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 36 | 0 | $t->logError($glitch->hash, $status); | |||||||||||||
| 37 | } | ||||||||||||||
| 38 | |||||||||||||||
| 39 | 0 | ▶ | sub logInfo { | ||||||||||||
|
Subroutine
logInfo: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||
| 40 | 0 | my ($self, $t, $name, $status) = @_; | |||||||||||||
| 41 | 0 | my $glitch = $self->call($name); | |||||||||||||
| 42 | 0 | ▶ | $self->extend($glitch) if $self->can('extend'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 43 | 0 | $t->logInfo($glitch->hash); | |||||||||||||
| 44 | } | ||||||||||||||
| 45 | |||||||||||||||
| 46 | 1 | 1; | |||||||||||||
| 47 | |||||||||||||||
| 48 | __END__ | ||||||||||||||