line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Router::Boom::Node; |
2
|
6
|
|
|
6
|
|
27
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
199
|
|
3
|
6
|
|
|
6
|
|
24
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
167
|
|
4
|
6
|
|
|
6
|
|
1980
|
use utf8; |
|
6
|
|
|
|
|
32
|
|
|
6
|
|
|
|
|
30
|
|
5
|
6
|
|
|
6
|
|
223
|
use 5.008_001; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
501
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Class::Accessor::Lite 0.05 ( |
8
|
6
|
|
|
|
|
48
|
rw => [qw(leaf)], |
9
|
|
|
|
|
|
|
ro => [qw(key children)], |
10
|
6
|
|
|
6
|
|
3600
|
); |
|
6
|
|
|
|
|
6948
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
33
|
|
|
33
|
0
|
39
|
my $class = shift; |
14
|
33
|
50
|
|
|
|
96
|
my %args = @_==1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
15
|
33
|
|
|
|
|
159
|
bless { |
16
|
|
|
|
|
|
|
children => +[], |
17
|
|
|
|
|
|
|
%args, |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
6
|
|
932
|
use re 'eval'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
899
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_node { |
24
|
32
|
|
|
32
|
0
|
36
|
my ($self, $child) = @_; |
25
|
32
|
|
|
|
|
36
|
for (my $i=0; $i<@{$self->{children}}; $i++) { |
|
47
|
|
|
|
|
94
|
|
26
|
20
|
100
|
|
|
|
46
|
if ($self->{children}->[$i]->{key} eq $child) { |
27
|
5
|
|
|
|
|
24
|
return $self->{children}->[$i]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
27
|
|
|
|
|
24
|
push @{$self->{children}}, Router::Boom::Node->new(key => $child); |
|
27
|
|
|
|
|
51
|
|
31
|
27
|
|
|
|
|
115
|
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
|
|
|
|
|
|
|
|