line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Router::Boom::Node; |
2
|
6
|
|
|
6
|
|
42
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
1472
|
|
3
|
6
|
|
|
6
|
|
38
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
183
|
|
4
|
6
|
|
|
6
|
|
8257
|
use utf8; |
|
6
|
|
|
|
|
37
|
|
|
6
|
|
|
|
|
40
|
|
5
|
6
|
|
|
6
|
|
248
|
use 5.008_001; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
464
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Class::Accessor::Lite 0.05 ( |
8
|
6
|
|
|
|
|
66
|
rw => [qw(leaf)], |
9
|
|
|
|
|
|
|
ro => [qw(key children)], |
10
|
6
|
|
|
6
|
|
6304
|
); |
|
6
|
|
|
|
|
11707
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
33
|
|
|
33
|
0
|
43
|
my $class = shift; |
14
|
33
|
50
|
|
|
|
117
|
my %args = @_==1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
15
|
33
|
|
|
|
|
209
|
bless { |
16
|
|
|
|
|
|
|
children => +[], |
17
|
|
|
|
|
|
|
%args, |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
6
|
|
1348
|
use re 'eval'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
1054
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_node { |
24
|
32
|
|
|
32
|
0
|
50
|
my ($self, $child) = @_; |
25
|
32
|
|
|
|
|
42
|
for (my $i=0; $i<@{$self->{children}}; $i++) { |
|
47
|
|
|
|
|
131
|
|
26
|
20
|
100
|
|
|
|
61
|
if ($self->{children}->[$i]->{key} eq $child) { |
27
|
5
|
|
|
|
|
36
|
return $self->{children}->[$i]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
27
|
|
|
|
|
34
|
push @{$self->{children}}, Router::Boom::Node->new(key => $child); |
|
27
|
|
|
|
|
72
|
|
31
|
27
|
|
|
|
|
150
|
return $self->{children}->[-1]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub as_arrayref { |
37
|
|
|
|
|
|
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
[$self->key, [map { $_->as_arrayref } @{$self->children}], $self->leaf]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|