« blib/lib/Tapper/Reports/Web/Controller/Tapper/User.pm
↑ Summary
blib/lib/Tapper/Reports/Web/Controller/Root.pm »
| 1 | package Tapper::Reports::Web::Util; | ||||||||||||
| 2 | 22 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||||
| 3 | 22 | $Tapper::Reports::Web::Util::VERSION = '5.0.17'; | |||||||||||
| 4 | 22 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 22 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 22 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 22 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 22 | ▶ | use Perl6::Junction qw /any/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | sub prepare_top_menu | ||||||||||||
| 13 | 21 | ▶ | { | ||||||||||
|
Subroutine
prepare_top_menu: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||
| 14 | 21 | my ($self, $active) = @_; | |||||||||||
| 15 | 21 | my $top_menu = [ | |||||||||||
| 16 | { key => 'start', text => 'Start', uri => "/tapper/start/", }, | ||||||||||||
| 17 | { key => 'reports', text => 'Reports', uri => "/tapper/reports", }, | ||||||||||||
| 18 | { key => 'testruns', text => 'Testruns', uri => "/tapper/testruns", }, | ||||||||||||
| 19 | { key => 'testplans', text => 'Testplans', uri => "/tapper/testplan", }, | ||||||||||||
| 20 | { key => 'continuoustestruns', text => 'Continuous Testruns', uri => "/tapper/continuoustestruns",}, | ||||||||||||
| 21 | { key => 'metareports', text => 'Metareports', uri => "/tapper/metareports/", }, | ||||||||||||
| 22 | { key => 'manual', text => 'Manual', uri => "/tapper/manual/", }, | ||||||||||||
| 23 | ]; | ||||||||||||
| 24 | |||||||||||||
| 25 | # Some keys may be singular with their actions being named in plural or vice versa. Unify this. | ||||||||||||
| 26 | 21 | ▶ | if ($active) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 18 | $active = lc($active); | |||||||||||
| 28 | 18 | ▶ | (my $active_singular) = ($active =~ m/^(.+)s$/) // ''; | ||||||||||
|
Condition50%1/2
$active =~ /^(.+)s$/ // ""
MC/DC0%0/1
$active =~ /^(.+)s$/ // ""
$active =~ /^(.+)s$/
Truth table50%1/2
A
A= $active =~ /^(.+)s$/
| |||||||||||||
| 29 | 18 | ▶ | (my $active_plural) = $active."s" // ''; | ||||||||||
|
Condition50%1/2
$active . 's' // ""
MC/DC0%0/1
$active . 's' // ""
$active . 's'
Truth table50%1/2
A
A= $active . 's'
| |||||||||||||
| 30 | 18 | ▶ | foreach (@$top_menu) { $_->{active} = 1 if $_->{key} eq any($active, $active_singular, $active_plural) } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | } | ||||||||||||
| 32 | 21 | return $top_menu; | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | |||||||||||||
| 36 | |||||||||||||
| 37 | 22 | 1; | |||||||||||
| 38 | |||||||||||||
| 39 | __END__ | ||||||||||||