ObjectXS/Array.pm

filter: Statementstmt 100% 35 / 35 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 97.6% 42 / 43 CC 3 SCAR 5.6
CC
3
Cov
97%
import
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
↑ Summary ObjectXS.pm »
1 package Tree::ObjectXS::Array;
2  
3 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8 2 our $DATE = '2021-10-07'; # DATE
9 2 our $DIST = 'Tree-ObjectXS'; # DIST
10 2 our $VERSION = '0.030'; # VERSION
11  
12 1 ▶sub import {
Subroutine import: called CC=3 SCAR=11.0
13 1 my ($class0, @attrs) = @_;
14  
15 1 my $caller = caller();
16  
17 1 my $code_str = "package $caller;\n";
18 1 $code_str .= "use Class::XSAccessor::Array {\n";
19 1 $code_str .= " constructor => 'new',\n";
20 1 $code_str .= " accessors => {\n";
21 1 my $idx = 0;
22 1 for (@attrs, "parent", "children") {
23 3 $code_str .= " '$_' => $idx,\n";
24 3 $idx++;
25 }
26 1 $code_str .= " },\n";
27 1 $code_str .= "};\n";
28 1 $code_str .= "use Role::Tiny::With;\n";
29 1 $code_str .= "with 'Role::TinyCommons::Tree::NodeMethods';\n";
30  
31 #say $code_str;
32  
33 1 ▶ eval $code_str; ## no critic: BuiltinFunctions::ProhibitStringyEval
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶ die if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
35 }
36  
37 2 1;
38 # ABSTRACT: An array-based tree object
39  
40 __END__
↑ Summary ObjectXS.pm »