blib/lib/CatalystX/TraitFor/Dispatcher/ExactMatch.pm

filter: Statementstmt 48.4% 16 / 33 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 41.1% 21 / 51 CC 7 SCAR 35.0
CC
7
Cov
38%
__ANON__
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 33.1
↑ Summary
1 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package CatalystX::TraitFor::Dispatcher::ExactMatch;
6  
7 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 BEGIN
10 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $CatalystX::TraitFor::Dispatcher::ExactMatch::AUTHORITY = 'cpan:TOBYINK';
12 1 $CatalystX::TraitFor::Dispatcher::ExactMatch::VERSION = '0.003';
13 }
14  
15 1 requires qw( dispatch_types );
16  
17 around prepare_action => sub
18 0 ▶{
Subroutine __ANON__: not called CC=7 SCAR=40.3
19 0 my $next = shift;
20 0 my $self = shift;
21 0 my ($ctx, @etc) = @_;
22
23 0 my $req = $ctx->req;
24 0 (my $path = $req->path) =~ s{^/+}{};
25
26 0 my $matched = 0;
27 0 foreach my $type ( @{ $self->dispatch_types } )
28 {
29 0 ▶ if (!$matched and $type->match($ctx, $path))
Branch: 1 branch
BranchTrueFalseTotal
if (not $matched and $type->match($ctx, $path)) 0 0 0
Condition0%0/3
not $matched and $type->match($ctx, $path)
!ll&&!rl&&r
000
MC/DC0%0/2
not $matched and $type->match($ctx, $path)
not $matched $type->match($ctx, $path)
Truth table0%0/3
not(A) and B
A= not $matchedB= $type->match($ctx, $path)
ABresult
0X0
100
111
30 {
31 0 $matched++;
32 }
33 }
34
35 0 ▶ if ($matched)
Branch: 1 branch
BranchTrueFalseTotal
if ($matched) 0 0 0
36 {
37 0 $ctx->log->debug(sprintf('Got exact match "%s"', $req->match));
38 0 ▶ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg foreach grep { defined } @{$req->captures||[]};
Condition0%0/2
$req->captures || []
l!l
00
MC/DC0%0/1
$req->captures || []
$req->captures
Truth table0%0/2
A
A= $req->captures
Aresult
11
00
39 }
40
41 0 $self->$next($ctx, @etc);
42 1 };
43  
44 1 'fixed';
45  
46 __END__
↑ Summary