line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::Base; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::Base::VERSION = '1.1000'; |
3
|
11
|
|
|
11
|
|
4220
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
240
|
|
4
|
11
|
|
|
11
|
|
47
|
use warnings; |
|
11
|
|
|
|
|
38
|
|
|
11
|
|
|
|
|
279
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
48
|
use parent qw(HTML::Widgets::NavMenu::Tree::Iterator); |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
53
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_acc_ref( |
9
|
|
|
|
|
|
|
[ |
10
|
|
|
|
|
|
|
qw( |
11
|
|
|
|
|
|
|
_html |
12
|
|
|
|
|
|
|
nav_menu |
13
|
|
|
|
|
|
|
) |
14
|
|
|
|
|
|
|
] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _init |
19
|
|
|
|
|
|
|
{ |
20
|
354
|
|
|
354
|
|
461
|
my $self = shift; |
21
|
354
|
|
|
|
|
438
|
my $args = shift; |
22
|
|
|
|
|
|
|
|
23
|
354
|
|
|
|
|
868
|
$self->SUPER::_init($args); |
24
|
|
|
|
|
|
|
|
25
|
354
|
100
|
|
|
|
878
|
$self->nav_menu( $args->{'nav_menu'} ) |
26
|
|
|
|
|
|
|
or die "nav_menu not specified!"; |
27
|
|
|
|
|
|
|
|
28
|
353
|
|
|
|
|
597
|
$self->_html( [] ); |
29
|
|
|
|
|
|
|
|
30
|
353
|
|
|
|
|
601
|
return 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _add_tags |
34
|
|
|
|
|
|
|
{ |
35
|
673
|
|
|
673
|
|
851
|
my $self = shift; |
36
|
673
|
|
|
|
|
787
|
push( @{ $self->_html() }, @_ ); |
|
673
|
|
|
|
|
1875
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _is_root |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
return ( $self->stack->len() == 1 ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_initial_node |
48
|
|
|
|
|
|
|
{ |
49
|
385
|
|
|
385
|
1
|
501
|
my $self = shift; |
50
|
385
|
|
|
|
|
866
|
return $self->nav_menu->_get_traversed_tree(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_node_subs |
55
|
|
|
|
|
|
|
{ |
56
|
1249
|
|
|
1249
|
1
|
1740
|
my ( $self, $args ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
1249
|
|
|
|
|
1591
|
my $node = $args->{'node'}; |
59
|
|
|
|
|
|
|
|
60
|
1249
|
|
|
|
|
1579
|
return [ @{ $node->subs() } ]; |
|
1249
|
|
|
|
|
3551
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# TODO : This method is too long - refactor. |
65
|
|
|
|
|
|
|
sub get_new_accum_state |
66
|
|
|
|
|
|
|
{ |
67
|
1249
|
|
|
1249
|
1
|
1881
|
my ( $self, $args ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1249
|
|
|
|
|
1570
|
my $parent_item = $args->{'item'}; |
70
|
1249
|
|
|
|
|
1484
|
my $node = $args->{'node'}; |
71
|
|
|
|
|
|
|
|
72
|
1249
|
|
|
|
|
1456
|
my $prev_state; |
73
|
1249
|
100
|
|
|
|
1872
|
if ( defined($parent_item) ) |
74
|
|
|
|
|
|
|
{ |
75
|
812
|
|
|
|
|
1150
|
$prev_state = $parent_item->_accum_state(); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else |
78
|
|
|
|
|
|
|
{ |
79
|
437
|
|
|
|
|
612
|
$prev_state = +{}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
1249
|
|
|
|
|
1686
|
my $show_always = 0; |
83
|
1249
|
100
|
|
|
|
2286
|
if ( exists( $prev_state->{'show_always'} ) ) |
84
|
|
|
|
|
|
|
{ |
85
|
812
|
|
|
|
|
1048
|
$show_always = $prev_state->{'show_always'}; |
86
|
|
|
|
|
|
|
} |
87
|
1249
|
100
|
|
|
|
2236
|
if ( defined( $node->show_always() ) ) |
88
|
|
|
|
|
|
|
{ |
89
|
45
|
|
|
|
|
77
|
$show_always = $node->show_always(); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
1249
|
|
|
|
|
1425
|
my $rec_url_type; |
93
|
1249
|
100
|
|
|
|
1894
|
if ( exists( $prev_state->{'rec_url_type'} ) ) |
94
|
|
|
|
|
|
|
{ |
95
|
812
|
|
|
|
|
1037
|
$rec_url_type = $prev_state->{'rec_url_type'}; |
96
|
|
|
|
|
|
|
} |
97
|
1249
|
100
|
|
|
|
2191
|
if ( defined( $node->rec_url_type() ) ) |
98
|
|
|
|
|
|
|
{ |
99
|
20
|
|
|
|
|
36
|
$rec_url_type = $node->rec_url_type(); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
return { |
102
|
1249
|
100
|
|
|
|
5653
|
'host' => ( $node->host() ? $node->host() : $prev_state->{'host'} ), |
103
|
|
|
|
|
|
|
'show_always' => $show_always, |
104
|
|
|
|
|
|
|
'rec_url_type' => $rec_url_type, |
105
|
|
|
|
|
|
|
}; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub get_results |
110
|
|
|
|
|
|
|
{ |
111
|
50
|
|
|
50
|
1
|
73
|
my $self = shift; |
112
|
|
|
|
|
|
|
|
113
|
50
|
|
|
|
|
66
|
return [ @{ $self->_html() } ]; |
|
50
|
|
|
|
|
223
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |