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