| 1 | package Catalyst::DispatchType::Default; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 154 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 154 | extends 'Catalyst::DispatchType'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 154 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | Catalyst::DispatchType::Default - Default DispatchType | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | See L<Catalyst::DispatchType>. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Dispatch type managing default behaviour. For more information on | ||||||||||||||||||||||||||||
| 19 | dispatch types, see: | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =over 4 | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =item * L<Catalyst::Manual::Intro> for how they affect application authors | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =item * L<Catalyst::DispatchType> for implementation information. | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =back | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 METHODS | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =head2 $self->match( $c, $path ) | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | If path is empty (i.e. all path parts have been converted into args), | ||||||||||||||||||||||||||||
| 34 | attempts to find a default for the namespace constructed from the args, | ||||||||||||||||||||||||||||
| 35 | or the last inherited default otherwise and will match that. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | If path is not empty, never matches since Default will only match if all | ||||||||||||||||||||||||||||
| 38 | other possibilities have been exhausted. | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =cut | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 631 | ▶ | sub match { | ||||||||||||||||||||||||||
|
Subroutine
match: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 631 | my ( $self, $c, $path ) = @_; | |||||||||||||||||||||||||||
| 44 | 631 | ▶ | return if $path ne ''; # Not at root yet, wait for it ... | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 68 | my $result = ( $c->get_actions( 'default', $c->req->path ) )[-1]; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # Find default on namespace or super | ||||||||||||||||||||||||||||
| 48 | 68 | ▶ | if ($result && $result->match($c)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$result and $result->match($c)
MC/DC50%1/2
$result and $result->match($c)
$result
$result->match($c)
Truth table66%2/3
A and B
A= $resultB= $result->match($c)
| |||||||||||||||||||||||||||||
| 49 | 58 | $c->action($result); | |||||||||||||||||||||||||||
| 50 | 58 | $c->namespace( $result->namespace ); | |||||||||||||||||||||||||||
| 51 | 58 | $c->req->action('default'); | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # default methods receive the controller name as the first argument | ||||||||||||||||||||||||||||
| 54 | 0 | ▶ | unshift @{ $c->req->args }, $path if $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 58 | $c->req->match(''); | |||||||||||||||||||||||||||
| 56 | 58 | return 1; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 10 | return 0; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 13 | ▶ | sub _is_low_precedence { 1 } | ||||||||||||||||||||||||||
|
Subroutine
_is_low_precedence: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | Catalyst Contributors, see Catalyst.pm | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | This library is free software. You can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 70 | the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =cut | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 154 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 154 | 1; | |||||||||||||||||||||||||||