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