| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||