line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::ToJSON::Data_Persistence; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::ToJSON::Data_Persistence::VERSION = '0.0.8'; |
3
|
2
|
|
|
2
|
|
1367
|
use 5.008; |
|
2
|
|
|
|
|
6
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
64
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use parent 'HTML::Widgets::NavMenu::Object'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_acc_ref( |
10
|
|
|
|
|
|
|
[ |
11
|
|
|
|
|
|
|
qw( |
12
|
|
|
|
|
|
|
_data |
13
|
|
|
|
|
|
|
), |
14
|
|
|
|
|
|
|
] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _get_id_persistence |
19
|
|
|
|
|
|
|
{ |
20
|
9
|
|
|
9
|
|
14
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
9
|
|
|
|
|
15
|
return $self->_data->{id_persistence}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _calc_initial_data |
26
|
|
|
|
|
|
|
{ |
27
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
5
|
return { id_persistence => { paths_ids => { }, next_id => 1, }, }; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_id_for_url |
33
|
|
|
|
|
|
|
{ |
34
|
9
|
|
|
9
|
1
|
15
|
my ($self, $url) = @_; |
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
|
|
12
|
my $ptr = $self->_get_id_persistence; |
37
|
|
|
|
|
|
|
|
38
|
9
|
50
|
|
|
|
20
|
if (! exists($ptr->{paths_ids}->{$url})) |
39
|
|
|
|
|
|
|
{ |
40
|
9
|
|
|
|
|
16
|
$ptr->{paths_ids}->{$url} = ($ptr->{next_id}++); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
9
|
|
|
|
|
19
|
return $ptr->{paths_ids}->{$url}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; # End of HTML::Widgets::NavMenu::ToJSON::Data_Persistence |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |