1package Forest::Tree::Loader;
2use Moose::Role;
3
4our $VERSION   = '0.10';
5our $AUTHORITY = 'cpan:STEVAN';
6
7with 'Forest::Tree::Constructor';
8
9has '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 => ... )
24has tree_class => (
25    isa => "ClassName",
26    is  => "ro",
27    reader => "_tree_class",
28    default => sub { ref shift->tree },
29);
30
31sub tree_class { shift->_tree_class(@_) }
32
33requires 'load';
34
35no Moose::Role; 1;
36
37__END__
38
39=pod
40
41=head1 NAME
42
43Forest::Tree::Loader - An abstract role for loading trees
44
45=head1 DESCRIPTION
46
47B<This role should generally not be used, it has been largely superseded by Forest::Tree::Builder>.
48
49This 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
61All complex software has bugs lurking in it, and this module is no
62exception. If you find a bug please either email me, or add the bug
63to cpan-RT.
64
65=head1 AUTHOR
66
67Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
68
69=head1 COPYRIGHT AND LICENSE
70
71Copyright 2008-2014 Infinity Interactive, Inc.
72
73L<http://www.iinteractive.com>
74
75This library is free software; you can redistribute it and/or modify
76it under the same terms as Perl itself.
77
78=cut
79