line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Forest::Tree::Roles::HasNodeFormatter; |
2
|
5
|
|
|
5
|
|
6977
|
use Moose::Role; |
|
5
|
|
|
|
|
155
|
|
|
5
|
|
|
|
|
60
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
5
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'node_formatter' => ( |
8
|
|
|
|
|
|
|
is => 'rw', |
9
|
|
|
|
|
|
|
isa => 'CodeRef|Str', |
10
|
|
|
|
|
|
|
lazy => 1, |
11
|
|
|
|
|
|
|
default => sub { |
12
|
|
|
|
|
|
|
sub { (shift)->node || 'undef' } |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub format_node { |
17
|
162
|
|
|
162
|
0
|
389
|
my ( $self, $node, @args ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
162
|
|
|
|
|
12100
|
my $fmt = $self->node_formatter; |
20
|
|
|
|
|
|
|
|
21
|
162
|
|
|
|
|
403
|
$node->$fmt(@args); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
5
|
|
40011
|
no Moose::Role; 1; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
49
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Forest::Tree::Roles::HasNodeFormatter - Simple role for custom node formatters |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Simple role for nodes that have custom formatters |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 BUGS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
All complex software has bugs lurking in it, and this module is no |
41
|
|
|
|
|
|
|
exception. If you find a bug please either email me, or add the bug |
42
|
|
|
|
|
|
|
to cpan-RT. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Stevan Little E<lt>stevan.little@iinteractive.comE<gt> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Copyright 2008-2014 Infinity Interactive, Inc. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L<http://www.iinteractive.com> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
55
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |