| 1 | package HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive; | ||||||||||||||||||||||||||||||||||
| 2 | 15 | $HTML::Widgets::NavMenu::Iterator::GetCurrentlyActive::VERSION = '1.1000'; | |||||||||||||||||||||||||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use parent 'HTML::Widgets::NavMenu::Iterator::Base'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 15 | __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 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 22 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 23 | 52 | my $args = shift; | |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 52 | $self->SUPER::_init($args); | |||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | 52 | $self->_tree( $args->{'tree'} ); | |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | 52 | $self->_item_found(0); | |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||
| 31 | 52 | return 0; | |||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||
| 34 | sub get_initial_node | ||||||||||||||||||||||||||||||||||
| 35 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_initial_node: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 36 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||
| 38 | 52 | return $self->_tree; | |||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | sub item_matches | ||||||||||||||||||||||||||||||||||
| 42 | 270 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
item_matches: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 43 | 270 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 44 | 270 | my $item = $self->top(); | |||||||||||||||||||||||||||||||||
| 45 | 270 | my $url = $item->_node()->url(); | |||||||||||||||||||||||||||||||||
| 46 | 270 | my $nav_menu = $self->nav_menu(); | |||||||||||||||||||||||||||||||||
| 47 | 270 | ▶ | return ( ( $item->_accum_state()->{'host'} eq $nav_menu->current_host() ) | ||||||||||||||||||||||||||||||||
|
Condition100%6/6
$item->_accum_state->{'host'} eq $nav_menu->current_host && (defined $url && $url eq $nav_menu->path_info)
defined $url and $url eq $nav_menu->path_info
MC/DC100%3/3
$item->_accum_state->{'host'} eq $nav_menu->current_host && (defined $url && $url eq $nav_menu->path_info)
$item->_accum_state->{'host'} eq $nav_menu->current_host
defined $url
$url eq $nav_menu->path_info
Truth table100%4/4
A && B and C
A= $item->_accum_state->{'host'} eq $nav_menu->current_hostB= defined $urlC= $url eq $nav_menu->path_info
| |||||||||||||||||||||||||||||||||||
| 48 | && ( defined($url) && ( $url eq $nav_menu->path_info() ) ) ); | ||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | sub does_item_expand | ||||||||||||||||||||||||||||||||||
| 52 | 243 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
does_item_expand: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 53 | 243 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 54 | 243 | my $item = $self->top(); | |||||||||||||||||||||||||||||||||
| 55 | 243 | return $item->_node()->capture_expanded(); | |||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||
| 58 | sub node_start | ||||||||||||||||||||||||||||||||||
| 59 | 270 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
node_start: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 60 | 270 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | 270 | ▶ | if ( $self->item_matches() ) | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||
| 64 | 27 | my @coords = @{ $self->get_coords() }; | |||||||||||||||||||||||||||||||||
| 65 | 27 | $self->_ret_coords( [@coords] ); | |||||||||||||||||||||||||||||||||
| 66 | 27 | $self->_temp_coords( [ @coords, (-1) ] ); | |||||||||||||||||||||||||||||||||
| 67 | 27 | $self->top()->_node()->mark_as_current(); | |||||||||||||||||||||||||||||||||
| 68 | 27 | $self->_item_found(1); | |||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||
| 70 | elsif ( $self->does_item_expand() ) | ||||||||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||||||||
| 72 | 23 | my @coords = @{ $self->get_coords() }; | |||||||||||||||||||||||||||||||||
| 73 | 23 | $self->_leading_path_coords( [@coords] ); | |||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | sub node_end | ||||||||||||||||||||||||||||||||||
| 78 | 270 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
node_end: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 79 | 270 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 80 | 270 | ▶ | if ( $self->_item_found() ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||||||||
| 82 | # Skip the first node, because the coords refer | ||||||||||||||||||||||||||||||||||
| 83 | # to the nodes below it. | ||||||||||||||||||||||||||||||||||
| 84 | 61 | my $idx = pop( @{ $self->_temp_coords() } ); | |||||||||||||||||||||||||||||||||
| 85 | 61 | ▶ | if ( $idx >= 0 ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||||||
| 87 | 34 | my $node = $self->top()->_node(); | |||||||||||||||||||||||||||||||||
| 88 | 34 | $node->update_based_on_sub( $node->get_nth_sub($idx) ); | |||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||
| 93 | sub node_should_recurse | ||||||||||||||||||||||||||||||||||
| 94 | 488 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
node_should_recurse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 95 | 488 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 96 | 488 | return ( !$self->_item_found() ); | |||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||
| 99 | sub get_final_coords | ||||||||||||||||||||||||||||||||||
| 100 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_final_coords: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 101 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||
| 103 | 52 | return $self->_ret_coords(); | |||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||
| 106 | sub _get_leading_path_coords | ||||||||||||||||||||||||||||||||||
| 107 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
_get_leading_path_coords: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 108 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||
| 110 | 52 | ▶ | return ( $self->_ret_coords() || $self->_leading_path_coords() ); | ||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->_ret_coords || $self->_leading_path_coords
MC/DC100%2/2
$self->_ret_coords || $self->_leading_path_coords
$self->_ret_coords
$self->_leading_path_coords
Truth table100%3/3
A || B
A= $self->_ret_coordsB= $self->_leading_path_coords
| |||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||
| 113 | 15 | 1; | |||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||
| 115 | __END__ | ||||||||||||||||||||||||||||||||||