line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::Base; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::Base::VERSION = '1.0901'; |
3
|
11
|
|
|
11
|
|
4704
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
256
|
|
4
|
11
|
|
|
11
|
|
45
|
use warnings; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
277
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
61
|
use parent qw(HTML::Widgets::NavMenu::Tree::Iterator); |
|
11
|
|
|
|
|
36
|
|
|
11
|
|
|
|
|
103
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_acc_ref( |
9
|
|
|
|
|
|
|
[ |
10
|
|
|
|
|
|
|
qw( |
11
|
|
|
|
|
|
|
_html |
12
|
|
|
|
|
|
|
nav_menu |
13
|
|
|
|
|
|
|
) |
14
|
|
|
|
|
|
|
] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _init |
19
|
|
|
|
|
|
|
{ |
20
|
335
|
|
|
335
|
|
471
|
my $self = shift; |
21
|
335
|
|
|
|
|
430
|
my $args = shift; |
22
|
|
|
|
|
|
|
|
23
|
335
|
|
|
|
|
850
|
$self->SUPER::_init($args); |
24
|
|
|
|
|
|
|
|
25
|
335
|
100
|
|
|
|
827
|
$self->nav_menu( $args->{'nav_menu'} ) |
26
|
|
|
|
|
|
|
or die "nav_menu not specified!"; |
27
|
|
|
|
|
|
|
|
28
|
334
|
|
|
|
|
567
|
$self->_html( [] ); |
29
|
|
|
|
|
|
|
|
30
|
334
|
|
|
|
|
543
|
return 0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _add_tags |
34
|
|
|
|
|
|
|
{ |
35
|
673
|
|
|
673
|
|
880
|
my $self = shift; |
36
|
673
|
|
|
|
|
781
|
push( @{ $self->_html() }, @_ ); |
|
673
|
|
|
|
|
1874
|
|
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
|
366
|
|
|
366
|
1
|
545
|
my $self = shift; |
50
|
366
|
|
|
|
|
804
|
return $self->nav_menu->_get_traversed_tree(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_node_subs |
55
|
|
|
|
|
|
|
{ |
56
|
1211
|
|
|
1211
|
1
|
1699
|
my ( $self, $args ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
1211
|
|
|
|
|
1589
|
my $node = $args->{'node'}; |
59
|
|
|
|
|
|
|
|
60
|
1211
|
|
|
|
|
1393
|
return [ @{ $node->subs() } ]; |
|
1211
|
|
|
|
|
3672
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# TODO : This method is too long - refactor. |
65
|
|
|
|
|
|
|
sub get_new_accum_state |
66
|
|
|
|
|
|
|
{ |
67
|
1211
|
|
|
1211
|
1
|
1811
|
my ( $self, $args ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1211
|
|
|
|
|
1641
|
my $parent_item = $args->{'item'}; |
70
|
1211
|
|
|
|
|
1466
|
my $node = $args->{'node'}; |
71
|
|
|
|
|
|
|
|
72
|
1211
|
|
|
|
|
1410
|
my $prev_state; |
73
|
1211
|
100
|
|
|
|
1814
|
if ( defined($parent_item) ) |
74
|
|
|
|
|
|
|
{ |
75
|
793
|
|
|
|
|
1197
|
$prev_state = $parent_item->_accum_state(); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else |
78
|
|
|
|
|
|
|
{ |
79
|
418
|
|
|
|
|
581
|
$prev_state = +{}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
1211
|
|
|
|
|
1508
|
my $show_always = 0; |
83
|
1211
|
100
|
|
|
|
2037
|
if ( exists( $prev_state->{'show_always'} ) ) |
84
|
|
|
|
|
|
|
{ |
85
|
793
|
|
|
|
|
1015
|
$show_always = $prev_state->{'show_always'}; |
86
|
|
|
|
|
|
|
} |
87
|
1211
|
100
|
|
|
|
2186
|
if ( defined( $node->show_always() ) ) |
88
|
|
|
|
|
|
|
{ |
89
|
45
|
|
|
|
|
76
|
$show_always = $node->show_always(); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
1211
|
|
|
|
|
1486
|
my $rec_url_type; |
93
|
1211
|
100
|
|
|
|
1946
|
if ( exists( $prev_state->{'rec_url_type'} ) ) |
94
|
|
|
|
|
|
|
{ |
95
|
793
|
|
|
|
|
1033
|
$rec_url_type = $prev_state->{'rec_url_type'}; |
96
|
|
|
|
|
|
|
} |
97
|
1211
|
100
|
|
|
|
2029
|
if ( defined( $node->rec_url_type() ) ) |
98
|
|
|
|
|
|
|
{ |
99
|
19
|
|
|
|
|
31
|
$rec_url_type = $node->rec_url_type(); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
return { |
102
|
1211
|
100
|
|
|
|
5725
|
'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
|
77
|
my $self = shift; |
112
|
|
|
|
|
|
|
|
113
|
50
|
|
|
|
|
101
|
return [ @{ $self->_html() } ]; |
|
50
|
|
|
|
|
227
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |