lib/Reaction/UI/Controller/Role/RedirectTo.pm

filter: Statementstmt 20.0% 4 / 20 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 50.0% 1 / 2 Podpod 100% 1 / 1 totaltotal 10.7% 6 / 56 CC 11 SCAR 48.0
CC
11
Cov
9%
redirect_to
132.0
BEGIN
1.0
CRAP 121.1
↑ Summary lib/Reaction/UI/ViewPort/SearchableListViewContainer.pm »
1 package Reaction::UI::Controller::Role::RedirectTo;
2  
3 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 0 ▶sub redirect_to {
Subroutine redirect_to: not called CC=11 SCAR=48.8
Pod documented
6 0 my ($self, $c, $to, $cap, $args, $attrs) = @_;
7  
8 0 $c->log->debug(
9 "Using redirect_to is now deprecated and may be removed in the future."
10 );
11  
12 #the confess calls could be changed later to $c->log ?
13 0 my $action;
14 0 my $reftype = ref($to);
15 0 ▶ if( $reftype eq '' ){
Branch: 3 branches
BranchTrueFalseTotal
if ($reftype eq '') { } 0 0 0
elsif ($reftype eq 'ARRAY' and @$to == 2) { } 0 0 0
elsif (builtin::blessed($to) and $to->isa('Catalyst::Action')) { } 0 0 0
16 0 $action = $self->action_for($to);
17 0 ▶ confess("Failed to locate action ${to} in " . blessed($self)) unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 0 0
18 ▶ } elsif($reftype eq 'ARRAY' && @$to == 2){ #is that overkill / too strict?
Condition0%0/3
$reftype eq "ARRAY" and @$to == 2
!ll&&!rl&&r
000
MC/DC0%0/2
$reftype eq "ARRAY" and @$to == 2
$reftype eq "ARRAY" @$to == 2
Truth table0%0/3
A and B
A= $reftype eq "ARRAY"B= @$to == 2
ABresult
0X0
100
111
19 0 $action = $c->controller($to->[0])->action_for($to->[1]);
20 0 ▶ confess("Failed to locate action $to->[1] in $to->[0]" ) unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 0 0
21 ▶ } elsif( blessed $to && $to->isa('Catalyst::Action') ){
Condition0%0/3
builtin::blessed($to) and $to->isa("Catalyst::Action")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($to) and $to->isa("Catalyst::Action")
builtin::blessed($to) $to->isa("Catalyst::Action")
Truth table0%0/3
A and B
A= builtin::blessed($to)B= $to->isa("Catalyst::Action")
ABresult
0X0
100
111
22 0 $action = $to;
23 } else{
24 0 confess("Failed to locate action from ${to}");
25 }
26  
27 0 ▶ $cap ||= $c->req->captures;
Condition0%0/3
$cap ||= $c->req->captures
l!l&&r!l&&!r
000
MC/DC0%0/2
$cap ||= $c->req->captures
$cap $c->req->captures
Truth table0%0/3
A ||= B
A= $capB= $c->req->captures
ABresult
1X1
011
000
28 0 ▶ $args ||= $c->req->args;
Condition0%0/3
$args ||= $c->req->args
l!l&&r!l&&!r
000
MC/DC0%0/2
$args ||= $c->req->args
$args $c->req->args
Truth table0%0/3
A ||= B
A= $argsB= $c->req->args
ABresult
1X1
011
000
29 0 ▶ $attrs ||= {};
Condition0%0/2
$attrs ||= {}
l!l
00
MC/DC0%0/1
$attrs ||= {}
$attrs
Truth table0%0/2
A
A= $attrs
Aresult
11
00
30 0 my $uri = $c->uri_for($action, $cap, @$args, $attrs);
31 0 $c->res->redirect($uri);
32 }
33  
34 4 1;
35  
36 __END__;
↑ Summary lib/Reaction/UI/ViewPort/SearchableListViewContainer.pm »