lib/Serge/Interface/PluginHost.pm

filter: Statementstmt 100% 129 / 129 Branchbran 57.1% 8 / 14 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 39 / 39 Podpod 0.0% 0 / 2 totaltotal 93.7% 180 / 192 SCAR 23.0
CC
10
Cov
95%
load_plugin
6.0
load_plugin_from_node
5.6
BEGIN
1.0
CRAP 10.0
« lib/Serge/Engine/Plugin/trademarks.pm ↑ Summary Build »
1 package Serge::Interface::PluginHost;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 sub load_plugin {
6 35 ▶ my ($self, $class, $data) = @_;
Subroutine load_plugin: called CC=6 SCAR=17.9
Pod undocumented
7  
8 35 ▶ print "Loading plugin: $class\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 35 35
9  
10 35 my $p;
11 35 ▶ eval('use '.$class.'; $p = '.$class.'->new($self);');
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
12 35 ▶ die "Can't create instance for plugin '$class': $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 35 35
13 35 ▶ print "Created plugin instance: '".$p->name."'\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 35 35
14  
15 35 ▶ $p->{debug} = 1 if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 35 35
16  
17 35 $p->init($data);
18 35 eval {
19 35 $p->validate_data;
20 };
21 35 ▶ die "Data validation failed for plugin '$class': $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 1 34 35
22  
23 34 return $p;
24 }
25  
26 sub load_plugin_from_node {
27 35 ▶ my ($self, $class_prefix, $node) = @_;
Subroutine load_plugin_from_node: called CC=5 SCAR=17.2
Pod undocumented
28 35 ▶ die "'plugin' parameter missing" unless exists $node->{plugin};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $node->{"plugin"} 0 35 35
29  
30 # if plugin name has '::', treat it as a full class name and don't expand it;
31 # otherwise, prepend the provided class prefix to form a full class name
32  
33 35 my $class = $node->{plugin};
34 35 ▶ $class = $class_prefix.'::'.$class if ($class_prefix ne '' && $class !~ m/::/);
Branch: 1 branch
BranchTrueFalseTotal
if $class_prefix ne "" and not $class =~ /::/ 35 0 35
Condition33%1/3
$class_prefix ne "" and not $class =~ /::/
!ll&&!rl&&r
0035
MC/DC0%0/2
$class_prefix ne "" and not $class =~ /::/
$class_prefix ne "" not $class =~ /::/
Truth table33%1/3
A and not(B)
A= $class_prefix ne ""B= not $class =~ /::/
ABresult
0X0
100
111
35  
36 35 ▶ return $self->load_plugin($class, $node->{data} || {});
Condition100%2/2
$node->{'data'} || {}
l!l
2114
MC/DC100%1/1
$node->{'data'} || {}
$node->{'data'}
Truth table100%2/2
A
A= $node->{'data'}
Aresult
11
00
37 }
38  
39 2 1;
« lib/Serge/Engine/Plugin/trademarks.pm ↑ Summary Build »