line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Tree::Simple::WithMetaData; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1023
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use base 'Tree::Simple'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
309
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _init { |
12
|
13
|
|
|
13
|
|
123
|
my $self = shift; |
13
|
13
|
|
|
|
|
41
|
$self->SUPER::_init(@_); |
14
|
13
|
|
|
|
|
291
|
$self->{meta_data} = {}; |
15
|
13
|
|
|
|
|
26
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
## meta data functions |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub addMetaData { |
21
|
2
|
|
|
2
|
1
|
7
|
my ($self, %data) = @_; |
22
|
2
|
|
|
|
|
2
|
my ($k, $v); |
23
|
2
|
|
|
|
|
10
|
while (($k, $v) = each %data) { |
24
|
2
|
|
|
|
|
15
|
$self->{meta_data}->{$k} = $v; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub hasMetaDataFor { |
29
|
4
|
|
|
4
|
1
|
3910
|
my ($self, $key) = @_; |
30
|
4
|
100
|
|
|
|
29
|
exists $self->{meta_data}->{$key} ? 1 : 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub getMetaDataFor { |
34
|
2
|
|
|
2
|
1
|
6
|
my ($self, $key) = @_; |
35
|
2
|
|
|
|
|
11
|
return $self->{meta_data}->{$key}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub fetchMetaData { |
39
|
4
|
|
|
4
|
1
|
9
|
my ($self, $key) = @_; |
40
|
4
|
100
|
|
|
|
26
|
return $self->{meta_data}->{$key} |
41
|
|
|
|
|
|
|
if exists $self->{meta_data}->{$key}; |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
|
|
3
|
my $current = $self; |
44
|
2
|
|
|
|
|
10
|
until ($current->isRoot) { |
45
|
6
|
100
|
|
|
|
70
|
return $current->{meta_data}->{$key} |
46
|
|
|
|
|
|
|
if exists $current->{meta_data}->{$key}; |
47
|
4
|
|
|
|
|
11
|
$current = $current->getParent(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return undef; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |