Data/Frame/Setup.pm

filter: Statementstmt 97.7% 87 / 89 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 21 / 21 Podpod n/a totaltotal 97.5% 117 / 120 CC 6 SCAR 4.8
CC
6
Cov
97%
_import_tag
4.0
import
2.0
_import
2.0
CRAP 1.6
« Data/Frame/Autobox.pm ↑ Summary Data/Frame/Examples.pm »
1 package Data::Frame::Setup;
2 20 $Data::Frame::Setup::VERSION = '0.006005';
3 # ABSTRACT: Import stuffs into Data::Frame classes
4  
5 20 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 20 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 20 ▶use feature ':5.16';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 20 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 20 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 20 ▶use Data::Dumper ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 20 ▶use Function::Parameters 2.001003;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 20 ▶use PDL::Lite (); # PDL::Lite is the minimal to get PDL work
Subroutine BEGIN: called CC=1 SCAR=0.0
17 20 ▶use Ref::Util 0.204 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
18 20 ▶use Safe::Isa 1.000009 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 20 ▶use Feature::Compat::Try ();
Subroutine BEGIN: called CC=1 SCAR=0.0
20 20 ▶use boolean ();
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 20 ▶use Moo 2.003004 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23 20 ▶use Moo::Role ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 20 ▶use List::AllUtils qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 20 ▶use Data::Frame::Autobox ();
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 20 ▶use Role::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30 20 Role::Tiny->apply_roles_to_package( 'PDL', 'Data::Frame::PDL' );
31  
32 # PDL versions between 2.040 and 2.054 has not PDL::Core::at_c
33 20 ▶unless (defined &PDL::Core::at_c) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &PDL::Core::at_c) 0 20 20
34 0 *PDL::Core::at_c = \&{"PDL::Core::at_bad_c"};
35 }
36  
37 50 ▶sub import {
Subroutine import: called CC=2 SCAR=6.9
38 50 my ( $class, @tags ) = @_;
39  
40 50 ▶ unless (@tags) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@tags) 49 1 50
41 49 @tags = qw(:base);
42 }
43 50 $class->_import( scalar(caller), @tags );
44 }
45  
46 146 ▶sub _import {
Subroutine _import: called CC=2 SCAR=6.9
47 146 my ( $class, $target, @tags ) = @_;
48  
49 146 for my $tag ( uniq @tags ) {
50 146 $class->_import_tag( $target, $tag );
51 }
52 }
53  
54 242 ▶sub _import_tag {
Subroutine _import_tag: called CC=4 SCAR=13.9
55 242 my ( $class, $target, $tag ) = @_;
56  
57 242 ▶ if ( $tag eq ':base' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($tag eq ':base') { } 145 97 242
elsif ($tag eq ':class') { } 35 62 97
elsif ($tag eq ':role') { } 61 1 62
58 145 strict->import::into($target);
59 145 warnings->import::into($target);
60 145 utf8->import::into($target);
61 145 feature->import::into( $target, ':5.16' );
62  
63 145 Carp->import::into($target);
64 145 Data::Dumper->import::into($target);
65 145 Function::Parameters->import::into($target);
66 145 Ref::Util->import::into($target);
67 145 Safe::Isa->import::into($target);
68 145 Feature::Compat::Try->import::into($target);
69 145 boolean->import::into($target);
70  
71 145 Data::Frame::Autobox->import::into($target);
72 }
73 elsif ( $tag eq ':class' ) {
74 35 $class->_import_tag( $target, ':base' );
75  
76 35 Function::Parameters->import::into( $target,
77 qw(classmethod :modifiers) );
78  
79 35 Moo->import::into($target);
80 # repeating to unimport warning experimental::try
81 35 Feature::Compat::Try->import::into($target);
82 }
83 elsif ( $tag eq ':role' ) {
84 61 $class->_import_tag( $target, ':base' );
85  
86 61 Function::Parameters->import::into( $target,
87 qw(classmethod :modifiers) );
88  
89 61 Moo::Role->import::into($target);
90 # repeating to unimport warning experimental::try
91 61 Feature::Compat::Try->import::into($target);
92 }
93 else {
94 1 croak qq["$tag" is not exported by the $class module\n];
95 }
96 }
97  
98 20 1;
99  
100 __END__
« Data/Frame/Autobox.pm ↑ Summary Data/Frame/Examples.pm »