Gears/Router/Proto.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.8% 23 / 24 CC 3 SCAR 6.9
CC
3
Cov
100%
add
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Gears/X/Logger.pm ↑ Summary Gears/Router/Pattern.pm »
1 package Gears::Router::Proto;
2 5 $Gears::Router::Proto::VERSION = '0.105';
3 5 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Mooish::Base -standard, -role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 requires qw(
7 pattern
8 );
9  
10 5 has param 'router' => (
11 isa => InstanceOf ['Gears::Router'],
12 weak_ref => 1,
13 );
14  
15 has field 'locations' => (
16 isa => ArrayRef [InstanceOf ['Gears::Router::Location']],
17 176 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
18 5 );
19  
20 171 ▶sub add ($self, $pattern, $data = {})
Subroutine add: called CC=3 SCAR=11.0
Pod undocumented
21 171 {
22 171 my $sep = $self->router->pattern_separator;
23 171 my $full_pattern = ($self->pattern =~ s{\Q$sep\E$}{}r) . $sep . ($pattern =~ s{^\Q$sep\E}{}r);
24 171 ▶ $full_pattern =~ s{\Q$sep\E$}{}
Branch: 1 branch
BranchTrueFalseTotal
unless $full_pattern eq $sep 167 4 171
25 unless $full_pattern eq $sep;
26  
27 171 my $location = $self->router->_build_location(
28 $data->%*,
29 router => $self->router,
30 pattern => $full_pattern,
31 );
32  
33 171 push $self->locations->@*, $location;
34 171 return $location;
35 }
36  
« Gears/X/Logger.pm ↑ Summary Gears/Router/Pattern.pm »