line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::Base; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::Base::VERSION = '1.0902'; |
3
|
11
|
|
|
11
|
|
4903
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
253
|
|
4
|
11
|
|
|
11
|
|
45
|
use warnings; |
|
11
|
|
|
|
|
36
|
|
|
11
|
|
|
|
|
266
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
66
|
use parent qw(HTML::Widgets::NavMenu::Tree::Iterator); |
|
11
|
|
|
|
|
36
|
|
|
11
|
|
|
|
|
90
|
|
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
|
|
512
|
my $self = shift; |
21
|
354
|
|
|
|
|
475
|
my $args = shift; |
22
|
|
|
|
|
|
|
|
23
|
354
|
|
|
|
|
914
|
$self->SUPER::_init($args); |
24
|
|
|
|
|
|
|
|
25
|
354
|
100
|
|
|
|
832
|
$self->nav_menu( $args->{'nav_menu'} ) |
26
|
|
|
|
|
|
|
or die "nav_menu not specified!"; |
27
|
|
|
|
|
|
|
|
28
|
353
|
|
|
|
|
669
|
$self->_html( [] ); |
29
|
|
|
|
|
|
|
|
30
|
353
|
|
|
|
|
586
|
return 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _add_tags |
34
|
|
|
|
|
|
|
{ |
35
|
673
|
|
|
673
|
|
831
|
my $self = shift; |
36
|
673
|
|
|
|
|
798
|
push( @{ $self->_html() }, @_ ); |
|
673
|
|
|
|
|
1984
|
|
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
|
552
|
my $self = shift; |
50
|
385
|
|
|
|
|
873
|
return $self->nav_menu->_get_traversed_tree(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_node_subs |
55
|
|
|
|
|
|
|
{ |
56
|
1249
|
|
|
1249
|
1
|
1727
|
my ( $self, $args ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
1249
|
|
|
|
|
1593
|
my $node = $args->{'node'}; |
59
|
|
|
|
|
|
|
|
60
|
1249
|
|
|
|
|
1461
|
return [ @{ $node->subs() } ]; |
|
1249
|
|
|
|
|
3849
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# TODO : This method is too long - refactor. |
65
|
|
|
|
|
|
|
sub get_new_accum_state |
66
|
|
|
|
|
|
|
{ |
67
|
1249
|
|
|
1249
|
1
|
1797
|
my ( $self, $args ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1249
|
|
|
|
|
1576
|
my $parent_item = $args->{'item'}; |
70
|
1249
|
|
|
|
|
1463
|
my $node = $args->{'node'}; |
71
|
|
|
|
|
|
|
|
72
|
1249
|
|
|
|
|
1411
|
my $prev_state; |
73
|
1249
|
100
|
|
|
|
1989
|
if ( defined($parent_item) ) |
74
|
|
|
|
|
|
|
{ |
75
|
812
|
|
|
|
|
1179
|
$prev_state = $parent_item->_accum_state(); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else |
78
|
|
|
|
|
|
|
{ |
79
|
437
|
|
|
|
|
585
|
$prev_state = +{}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
1249
|
|
|
|
|
1571
|
my $show_always = 0; |
83
|
1249
|
100
|
|
|
|
2156
|
if ( exists( $prev_state->{'show_always'} ) ) |
84
|
|
|
|
|
|
|
{ |
85
|
812
|
|
|
|
|
1016
|
$show_always = $prev_state->{'show_always'}; |
86
|
|
|
|
|
|
|
} |
87
|
1249
|
100
|
|
|
|
2224
|
if ( defined( $node->show_always() ) ) |
88
|
|
|
|
|
|
|
{ |
89
|
45
|
|
|
|
|
71
|
$show_always = $node->show_always(); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
1249
|
|
|
|
|
1448
|
my $rec_url_type; |
93
|
1249
|
100
|
|
|
|
1982
|
if ( exists( $prev_state->{'rec_url_type'} ) ) |
94
|
|
|
|
|
|
|
{ |
95
|
812
|
|
|
|
|
1045
|
$rec_url_type = $prev_state->{'rec_url_type'}; |
96
|
|
|
|
|
|
|
} |
97
|
1249
|
100
|
|
|
|
2164
|
if ( defined( $node->rec_url_type() ) ) |
98
|
|
|
|
|
|
|
{ |
99
|
20
|
|
|
|
|
30
|
$rec_url_type = $node->rec_url_type(); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
return { |
102
|
1249
|
100
|
|
|
|
5665
|
'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
|
86
|
my $self = shift; |
112
|
|
|
|
|
|
|
|
113
|
50
|
|
|
|
|
64
|
return [ @{ $self->_html() } ]; |
|
50
|
|
|
|
|
259
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |