Sleep/Routes.pm

filter: Statementstmt 30.4% 7 / 23 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 100% 3 / 3 totaltotal 34.2% 12 / 35 CC 4 SCAR 18.7
CC
4
Cov
26%
parse_url
12.0
new
6.0
resource
2.0
CRAP 6.5
↑ Summary SleepTest/Handler.pm »
1 package Sleep::Routes;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
7 0 my $klass = shift;
8 0 my $routes = shift;
9  
10 0 ▶ die "Not an ARRAY" unless ref($routes) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $routes eq "ARRAY" 0 0 0
11  
12 0 my $self = bless {
13 routes => $routes,
14 }, $klass;
15  
16 0 return $self;
17 }
18  
19  
20 0 ▶sub parse_url {
Subroutine parse_url: not called CC=3 SCAR=24.8
Pod documented
21 0 my $self = shift;
22 0 my $url = shift;
23  
24 0 for (@{$self->{routes}}) {
25 0 ▶ if (my (@vars) = $url =~ m/$_->{route}/) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@vars) = $url =~ /$_->{"route"}/) 0 0 0
26 0 return ($_, @vars);
27 }
28 }
29  
30 0 return;
31 }
32  
33 0 ▶sub resource {
Subroutine resource: not called CC=1 SCAR=6.9
Pod documented
34 0 my $self = shift;
35 0 my $url = shift;
36  
37 0 my ($route, @vars) = $self->parse_url($url);
38 0 return ($route, @vars);
39 }
40  
41 2 1;
42  
43 __END__
↑ Summary SleepTest/Handler.pm »