line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tree::ObjectXS::Array; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
68308
|
use 5.010001; |
|
1
|
|
|
|
|
13
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
211
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
8
|
|
|
|
|
|
|
our $DATE = '2021-10-07'; # DATE |
9
|
|
|
|
|
|
|
our $DIST = 'Tree-ObjectXS'; # DIST |
10
|
|
|
|
|
|
|
our $VERSION = '0.030'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
13
|
1
|
|
|
1
|
|
9
|
my ($class0, @attrs) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
2
|
my $caller = caller(); |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
15
|
my $code_str = "package $caller;\n"; |
18
|
1
|
|
|
|
|
3
|
$code_str .= "use Class::XSAccessor::Array {\n"; |
19
|
1
|
|
|
|
|
1
|
$code_str .= " constructor => 'new',\n"; |
20
|
1
|
|
|
|
|
2
|
$code_str .= " accessors => {\n"; |
21
|
1
|
|
|
|
|
1
|
my $idx = 0; |
22
|
1
|
|
|
|
|
2
|
for (@attrs, "parent", "children") { |
23
|
3
|
|
|
|
|
6
|
$code_str .= " '$_' => $idx,\n"; |
24
|
3
|
|
|
|
|
4
|
$idx++; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
|
|
2
|
$code_str .= " },\n"; |
27
|
1
|
|
|
|
|
1
|
$code_str .= "};\n"; |
28
|
1
|
|
|
|
|
1
|
$code_str .= "use Role::Tiny::With;\n"; |
29
|
1
|
|
|
|
|
2
|
$code_str .= "with 'Role::TinyCommons::Tree::NodeMethods';\n"; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#say $code_str; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
906
|
eval $code_str; ## no critic: BuiltinFunctions::ProhibitStringyEval |
|
1
|
|
|
1
|
|
3525
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
609
|
|
|
1
|
|
|
|
|
4308
|
|
|
1
|
|
|
|
|
38
|
|
|
1
|
|
|
|
|
72
|
|
34
|
1
|
50
|
|
|
|
4926
|
die if $@; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
# ABSTRACT: An array-based tree object |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |