File Coverage

blib/lib/Gears/Router/Proto.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 16 17 94.1


line stmt bran cond sub pod time code
1             package Gears::Router::Proto;
2             $Gears::Router::Proto::VERSION = '0.101';
3 4     4   3681 use v5.40;
  4         21  
4 4     4   32 use Mooish::Base -standard, -role;
  4         6  
  4         72  
5              
6             requires qw(
7             pattern
8             );
9              
10             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             default => sub { [] },
18             );
19              
20 148         199 sub add ($self, $pattern, $data = {})
  148         186  
21 148     148 0 962 {
  148         227  
  148         178  
22 148         1754 my $location = $self->router->_build_location(
23             $data->%*,
24             router => $self->router,
25             pattern => $self->pattern . $pattern,
26             );
27              
28 148         9368 push $self->locations->@*, $location;
29 148         398 return $location;
30             }
31