blib/lib/Otogiri/Plugin.pm

filter: Statementstmt 100% 33 / 33 Branchbran 62.5% 5 / 8 Conditioncond 80.0% 4 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 89.4% 51 / 57 CC 8 SCAR 16.3
CC
8
Cov
91%
load_plugin
8.2
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
↑ Summary
1 package Otogiri::Plugin;
2 4 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 our $VERSION = "0.03";
7  
8 4 ▶use Otogiri;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Module::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶sub load_plugin { #this code is taken from Teng/SQL::Maker's load_plugin
Subroutine load_plugin: called CC=8 SCAR=21.0
Pod documented
12 3 my ($class, $pkg, $opt) = @_;
13 3 ▶ $pkg = $pkg =~ s/^\+// ? $pkg : "Otogiri::Plugin::$pkg";
Branch: 1 branch
BranchTrueFalseTotal
$pkg =~ s/^\+// ? : 0 3 3
14 3 Module::Load::load($pkg);
15  
16 3 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 3 3
17 3 ▶ $class = 'DBIx::Otogiri' if ( $class eq 'Otogiri' );
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "Otogiri" 1 2 3
18  
19 3 ▶ my $alias = delete $opt->{alias} || +{};
Condition100%2/2
delete $opt->{'alias'} || {}
l!l
12
MC/DC100%1/1
delete $opt->{'alias'} || {}
delete $opt->{'alias'}
Truth table100%2/2
A
A= delete $opt->{'alias'}
Aresult
11
00
20 {
21 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 for my $method ( @{"${pkg}::EXPORT"} ){
23 6 ▶ *{$class . '::' . ($alias->{$method} || $method)} = $pkg->can($method);
Condition66%2/3
$alias->{$method} || $method
l!l&&r!l&&!r
150
MC/DC0%0/2
$alias->{$method} || $method
$alias->{$method} $method
Truth table66%2/3
A || B
A= $alias->{$method}B= $method
ABresult
1X1
011
000
24 }
25 }
26  
27 3 ▶ $pkg->init($class, $opt) if $pkg->can('init');
Branch: 1 branch
BranchTrueFalseTotal
if $pkg->can("init") 0 3 3
28 }
29  
30 4 *Otogiri::load_plugin = \&load_plugin;
31 4 *DBIx::Otogiri::load_plugin = \&load_plugin;
32  
33  
34  
35 4 1;
36 __END__
↑ Summary