| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Path::AttrRouter::Match; | 
| 2 | 8 |  |  | 8 |  | 36 | use Mouse; | 
|  | 8 |  |  |  |  | 11 |  | 
|  | 8 |  |  |  |  | 45 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | has action => ( | 
| 5 |  |  |  |  |  |  | is       => 'rw', | 
| 6 |  |  |  |  |  |  | isa      => 'Path::AttrRouter::Action', | 
| 7 |  |  |  |  |  |  | required => 1, | 
| 8 |  |  |  |  |  |  | ); | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has args => ( | 
| 11 |  |  |  |  |  |  | is         => 'rw', | 
| 12 |  |  |  |  |  |  | isa        => 'ArrayRef', | 
| 13 |  |  |  |  |  |  | required   => 1, | 
| 14 |  |  |  |  |  |  | ); | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | has captures => ( | 
| 17 |  |  |  |  |  |  | is         => 'rw', | 
| 18 |  |  |  |  |  |  | isa        => 'ArrayRef', | 
| 19 |  |  |  |  |  |  | required   => 1, | 
| 20 |  |  |  |  |  |  | ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | has router => ( | 
| 23 |  |  |  |  |  |  | is       => 'rw', | 
| 24 |  |  |  |  |  |  | required => 1, | 
| 25 |  |  |  |  |  |  | weak_ref => 1, | 
| 26 |  |  |  |  |  |  | ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 8 |  |  | 8 |  | 2497 | no Mouse; | 
|  | 8 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 30 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub dispatch { | 
| 31 | 3 |  |  | 3 | 0 | 2400 | my ($self, @args) = @_; | 
| 32 | 3 |  |  |  |  | 8 | my $action = $self->action; | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 3 | 50 |  |  |  | 6 | if (my @chain = @{ $action->chain }) { | 
|  | 3 |  |  |  |  | 16 |  | 
| 35 | 3 |  |  |  |  | 5 | my $last = pop @chain; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 3 |  |  |  |  | 16 | local $self->{captures} = $self->captures; | 
| 38 | 3 |  |  |  |  | 7 | for my $act (@chain) { | 
| 39 | 3 |  |  |  |  | 3 | my @c; | 
| 40 | 3 | 50 |  |  |  | 13 | if (defined $act->attributes->{CaptureArgs}[0]) { | 
| 41 | 3 |  |  |  |  | 31 | @c = splice @{ $self->{captures} }, | 
|  | 3 |  |  |  |  | 13 |  | 
| 42 |  |  |  |  |  |  | 0, $act->attributes->{CaptureArgs}[0]; | 
| 43 |  |  |  |  |  |  | } | 
| 44 | 3 |  |  |  |  | 6 | local $self->{captures} = \@c; | 
| 45 | 3 |  |  |  |  | 10 | $act->dispatch(@args, @c); | 
| 46 |  |  |  |  |  |  | } | 
| 47 | 3 |  |  |  |  | 17 | $last->dispatch(@args, @{ $self->args }); | 
|  | 3 |  |  |  |  | 12 |  | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | else { | 
| 50 | 0 | 0 |  |  |  |  | my @match_args = @{ $self->captures } ? @{ $self->captures } : @{ $self->args }; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 51 | 0 |  |  |  |  |  | $self->action->dispatch( @args, @match_args ); | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; |