line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive::VERSION = '1.1000'; |
3
|
11
|
|
|
11
|
|
59
|
use strict; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
247
|
|
4
|
11
|
|
|
11
|
|
57
|
use warnings; |
|
11
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
236
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
45
|
use parent 'HTML::Widgets::NavMenu::Iterator::Base'; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
78
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_acc_ref( |
9
|
|
|
|
|
|
|
[ |
10
|
|
|
|
|
|
|
qw( |
11
|
|
|
|
|
|
|
_item_found |
12
|
|
|
|
|
|
|
_leading_path_coords |
13
|
|
|
|
|
|
|
_ret_coords |
14
|
|
|
|
|
|
|
_temp_coords |
15
|
|
|
|
|
|
|
_tree |
16
|
|
|
|
|
|
|
) |
17
|
|
|
|
|
|
|
] |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _init |
21
|
|
|
|
|
|
|
{ |
22
|
52
|
|
|
52
|
|
71
|
my $self = shift; |
23
|
52
|
|
|
|
|
78
|
my $args = shift; |
24
|
|
|
|
|
|
|
|
25
|
52
|
|
|
|
|
150
|
$self->SUPER::_init($args); |
26
|
|
|
|
|
|
|
|
27
|
52
|
|
|
|
|
117
|
$self->_tree( $args->{'tree'} ); |
28
|
|
|
|
|
|
|
|
29
|
52
|
|
|
|
|
95
|
$self->_item_found(0); |
30
|
|
|
|
|
|
|
|
31
|
52
|
|
|
|
|
108
|
return 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_initial_node |
35
|
|
|
|
|
|
|
{ |
36
|
52
|
|
|
52
|
1
|
79
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
52
|
|
|
|
|
169
|
return $self->_tree; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub item_matches |
42
|
|
|
|
|
|
|
{ |
43
|
270
|
|
|
270
|
1
|
352
|
my $self = shift; |
44
|
270
|
|
|
|
|
527
|
my $item = $self->top(); |
45
|
270
|
|
|
|
|
514
|
my $url = $item->_node()->url(); |
46
|
270
|
|
|
|
|
394
|
my $nav_menu = $self->nav_menu(); |
47
|
270
|
|
66
|
|
|
1378
|
return ( ( $item->_accum_state()->{'host'} eq $nav_menu->current_host() ) |
48
|
|
|
|
|
|
|
&& ( defined($url) && ( $url eq $nav_menu->path_info() ) ) ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub does_item_expand |
52
|
|
|
|
|
|
|
{ |
53
|
243
|
|
|
243
|
1
|
354
|
my $self = shift; |
54
|
243
|
|
|
|
|
421
|
my $item = $self->top(); |
55
|
243
|
|
|
|
|
519
|
return $item->_node()->capture_expanded(); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub node_start |
59
|
|
|
|
|
|
|
{ |
60
|
270
|
|
|
270
|
1
|
371
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
270
|
100
|
|
|
|
415
|
if ( $self->item_matches() ) |
|
|
100
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
27
|
|
|
|
|
45
|
my @coords = @{ $self->get_coords() }; |
|
27
|
|
|
|
|
81
|
|
65
|
27
|
|
|
|
|
76
|
$self->_ret_coords( [@coords] ); |
66
|
27
|
|
|
|
|
67
|
$self->_temp_coords( [ @coords, (-1) ] ); |
67
|
27
|
|
|
|
|
60
|
$self->top()->_node()->mark_as_current(); |
68
|
27
|
|
|
|
|
93
|
$self->_item_found(1); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
elsif ( $self->does_item_expand() ) |
71
|
|
|
|
|
|
|
{ |
72
|
23
|
|
|
|
|
38
|
my @coords = @{ $self->get_coords() }; |
|
23
|
|
|
|
|
57
|
|
73
|
23
|
|
|
|
|
165
|
$self->_leading_path_coords( [@coords] ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub node_end |
78
|
|
|
|
|
|
|
{ |
79
|
270
|
|
|
270
|
1
|
391
|
my $self = shift; |
80
|
270
|
100
|
|
|
|
597
|
if ( $self->_item_found() ) |
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
# Skip the first node, because the coords refer |
83
|
|
|
|
|
|
|
# to the nodes below it. |
84
|
61
|
|
|
|
|
77
|
my $idx = pop( @{ $self->_temp_coords() } ); |
|
61
|
|
|
|
|
106
|
|
85
|
61
|
100
|
|
|
|
138
|
if ( $idx >= 0 ) |
86
|
|
|
|
|
|
|
{ |
87
|
34
|
|
|
|
|
70
|
my $node = $self->top()->_node(); |
88
|
34
|
|
|
|
|
79
|
$node->update_based_on_sub( $node->get_nth_sub($idx) ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub node_should_recurse |
94
|
|
|
|
|
|
|
{ |
95
|
488
|
|
|
488
|
1
|
661
|
my $self = shift; |
96
|
488
|
|
|
|
|
1319
|
return ( !$self->_item_found() ); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub get_final_coords |
100
|
|
|
|
|
|
|
{ |
101
|
52
|
|
|
52
|
1
|
82
|
my $self = shift; |
102
|
|
|
|
|
|
|
|
103
|
52
|
|
|
|
|
172
|
return $self->_ret_coords(); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub _get_leading_path_coords |
107
|
|
|
|
|
|
|
{ |
108
|
52
|
|
|
52
|
|
77
|
my $self = shift; |
109
|
|
|
|
|
|
|
|
110
|
52
|
|
100
|
|
|
191
|
return ( $self->_ret_coords() || $self->_leading_path_coords() ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |