File Coverage

blib/lib/Forest/Tree/Loader.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 10 11 90.9


line stmt bran cond sub pod time code
1             package Forest::Tree::Loader;
2 12     12   21108 use Moose::Role;
  12         25  
  12         115  
3              
4             our $VERSION = '0.10';
5             our $AUTHORITY = 'cpan:STEVAN';
6              
7             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             default => sub { Forest::Tree->new },
19             );
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             default => sub { ref shift->tree },
29             );
30              
31 81     81 0 4267 sub tree_class { shift->_tree_class(@_) }
32              
33             requires 'load';
34              
35 12     12   93569 no Moose::Role; 1;
  12         36  
  12         88  
36              
37             __END__
38              
39             =pod
40              
41             =head1 NAME
42              
43             Forest::Tree::Loader - An abstract role for loading trees
44              
45             =head1 DESCRIPTION
46              
47             B<This role should generally not be used, it has been largely superseded by Forest::Tree::Builder>.
48              
49             This is an abstract role to be used for loading trees from
50              
51             =head1 METHODS
52              
53             =over 4
54              
55             =item B<>
56              
57             =back
58              
59             =head1 BUGS
60              
61             All complex software has bugs lurking in it, and this module is no
62             exception. If you find a bug please either email me, or add the bug
63             to cpan-RT.
64              
65             =head1 AUTHOR
66              
67             Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
68              
69             =head1 COPYRIGHT AND LICENSE
70              
71             Copyright 2008-2014 Infinity Interactive, Inc.
72              
73             L<http://www.iinteractive.com>
74              
75             This library is free software; you can redistribute it and/or modify
76             it under the same terms as Perl itself.
77              
78             =cut