Embra/Role/Plugin.pm

filter: Statementstmt 100% 64 / 64 Branchbran 57.6% 15 / 26 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 81.9% 95 / 116 CC 18 SCAR 16.1
CC
18
Cov
85%
register_plugin
9.8
__ANON__
4.2
__ANON__
4.2
CRAP 5.0
« Embra/Role/ExtraListDeps.pm ↑ Summary Embra/Plugin/GatherDir.pm »
1 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package App::Embra::Role::Plugin;
5 24 $App::Embra::Role::Plugin::VERSION = '0.001'; # TRIAL
6 # ABSTRACT: something that gets plugged into App::Embra
7  
8 24 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 24 with 'App::Embra::Role::Logging';
13  
14 16 ▶around '_build_log_prefix' => func( $orig, $self ) {
Subroutine __ANON__: called CC=4 SCAR=14.3
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 16 16
unless scalar @_ > 1 0 16 16
if scalar @_ > 2 0 16 16
15 16 return "[${ \ $self->name }] ";
16 24 };
17  
18 16 ▶around '_build_logger' => func( $orig, $self ) {
Subroutine __ANON__: called CC=4 SCAR=14.5
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 16 16
unless scalar @_ > 1 0 16 16
if scalar @_ > 2 0 16 16
19 16 $self->embra->logger;
20 24 };
21  
22  
23 24 has 'embra' => (
24 is => 'ro',
25 required => 1,
26 );
27  
28  
29 15 ▶has 'name' => (
Subroutine __ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 15 15
30 24 is => 'ro',
31 default => method { ref $self },
32 24 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BUILDARGS: called CC=3 SCAR=11.0
33 22  
34 22 method BUILDARGS( @args ) {
35 22 my %args = @args;
36 22 ▶ my %attrs;
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args{$attr}) 15 7 22
37 15 for my $attr ( qw< name > ) {
38 if( not defined $args{$attr} ) {
39 delete $args{$attr};
40 }
41 22 }
42  
43 return \%args;
44 }
45 24 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine register_plugin: called CC=9 SCAR=22.8
Branch: 5 branches
BranchTrueFalseTotal
exists $args{'args'} ? : 7 2 9
unless ($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($args) 0 9 9
if exists $args{"embra"} and not +($Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra"))->check($embra) 0 9 9
if keys %args 0 9 9
if scalar @_ > 6 0 9 9
Condition55%5/9
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
l!l&&r!l&&!r
180
exists $args{"embra"} and not +($Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra"))->check($embra)
!ll&&!rl&&r
090
$Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra")
l!l&&r!l&&!r
180
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
$Method::Signatures::mutc{"cache"}{"HashRef"} "Method::Signatures"->_make_constraint("HashRef")
MC/DC0%0/2
exists $args{"embra"} and not +($Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra"))->check($embra)
exists $args{"embra"} not +($Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra"))->check($embra)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra")
$Method::Signatures::mutc{"cache"}{"App::Embra"} "Method::Signatures"->_make_constraint("App::Embra")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"HashRef"}B= "Method::Signatures"->_make_constraint("HashRef")
ABresult
1X1
011
000
Truth table33%1/3
A and not(B)
A= exists $args{"embra"}B= not +($Method::Signatures::mutc{"cache"}{"App::Embra"} ||= "Method::Signatures"->_make_constraint("App::Embra"))->check($embra)
ABresult
0X0
100
111
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"App::Embra"}B= "Method::Signatures"->_make_constraint("App::Embra")
ABresult
1X1
011
000
46 9  
47 9 method register_plugin( $class:, :$name, HashRef :$args = {}, App::Embra :$embra ) {
48 9 my $self = $class->new( embra => $embra, name => $name, %{ $args } );
49 9 $self->logger->debugf( '%sregistered with %s', $self->log_prefix, $args );
50 $embra->add_plugin( $self );
51 return $self;
52 24 }
53  
54 1;
55  
56 __END__
« Embra/Role/ExtraListDeps.pm ↑ Summary Embra/Plugin/GatherDir.pm »