| 1 | package Forest::Tree::Loader; | ||
| 2 | 12 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 12 | our $VERSION = '0.10'; | |
| 5 | 12 | our $AUTHORITY = 'cpan:STEVAN'; | |
| 6 | |||
| 7 | 12 | with 'Forest::Tree::Constructor'; | |
| 8 | |||
| 9 | has 'tree' => ( | ||
| 10 | is => 'ro', | ||
| 11 | writer => "_tree", | ||
| 12 | isa => 'Forest::Tree', | ||
| 13 | lazy => 1, | ||
| 14 | |||
| 15 | # FIXME should really be shift->create_new_subtree() but that breaks | ||
| 16 | # compatibility when this method is overridden and shouldn't apply to the | ||
| 17 | # root node... anyway, Loader should be deprecated anyway | ||
| 18 | 8 | ▶ | default => sub { Forest::Tree->new }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 12 | ); | |
| 20 | |||
| 21 | # more compatibility, the tree class is determined by the class of the root | ||
| 22 | # which might not be Forest::Tree in subclasses or with explicit | ||
| 23 | # ->new( tree => ... ) | ||
| 24 | has tree_class => ( | ||
| 25 | isa => "ClassName", | ||
| 26 | is => "ro", | ||
| 27 | reader => "_tree_class", | ||
| 28 | 10 | ▶ | default => sub { ref shift->tree }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 29 | 12 | ); | |
| 30 | |||
| 31 | 81 | ▶ | sub tree_class { shift->_tree_class(@_) } |
|
Subroutine
tree_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 32 | |||
| 33 | 12 | requires 'load'; | |
| 34 | |||
| 35 | 12 | ▶ | no Moose::Role; 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | __END__ | ||