| 1 | package Tree::Object::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-Object'; # DIST | |||||||||
| 10 | 2 | our $VERSION = '0.080'; # 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 | |||||||||||
| 19 | 1 | $code_str .= "use Class::Accessor::Array {\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 | |||||||||||
| 29 | 1 | $code_str .= "use Role::Tiny::With;\n"; | |||||||||
| 30 | 1 | $code_str .= "with 'Role::TinyCommons::Tree::NodeMethods';\n"; | |||||||||
| 31 | |||||||||||
| 32 | #say $code_str; | ||||||||||
| 33 | |||||||||||
| 34 | 1 | ▶ | eval $code_str; ## no critic: BuiltinFunctions::ProhibitStringyEval | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 1 | ▶ | die if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 2 | 1; | |||||||||
| 39 | # ABSTRACT: An array-based tree object | ||||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||