| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Moose; |
|
3
|
153
|
|
|
153
|
|
2560
|
extends 'Catalyst::DispatchType'; |
|
|
153
|
|
|
|
|
372
|
|
|
|
153
|
|
|
|
|
986
|
|
|
4
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
|
5
|
153
|
|
|
153
|
|
826737
|
|
|
|
153
|
|
|
|
|
408
|
|
|
|
153
|
|
|
|
|
1752
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Catalyst::DispatchType::Index - Index DispatchType |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
See L<Catalyst::DispatchType>. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Dispatch type managing behaviour for index pages. For more information on |
|
17
|
|
|
|
|
|
|
dispatch types, see: |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=over 4 |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item * L<Catalyst::Manual::Intro> for how they affect application authors |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item * L<Catalyst::DispatchType> for implementation information. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=back |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has _actions => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', isa => 'HashRef', default => sub { +{} } |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 $self->match( $c, $path ) |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Check if there's an index action for a given path, and set it up to use it |
|
38
|
|
|
|
|
|
|
if there is; only matches a full URI - if $c->req->args is already set |
|
39
|
|
|
|
|
|
|
this DispatchType is guaranteed not to match. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my ( $self, $c, $path ) = @_; |
|
44
|
|
|
|
|
|
|
return if @{ $c->req->args }; |
|
45
|
1397
|
|
|
1397
|
1
|
3126
|
my $result = $c->get_action( 'index', $path ); |
|
46
|
1397
|
100
|
|
|
|
1948
|
|
|
|
1397
|
|
|
|
|
3858
|
|
|
47
|
920
|
|
|
|
|
3763
|
return 0 unless $result && exists $self->_actions->{ $result->reverse }; |
|
48
|
|
|
|
|
|
|
|
|
49
|
920
|
100
|
100
|
|
|
4811
|
if ($result && $result->match($c)) { |
|
50
|
|
|
|
|
|
|
$c->action($result); |
|
51
|
27
|
50
|
33
|
|
|
88
|
$c->namespace( $result->namespace ); |
|
52
|
27
|
|
|
|
|
722
|
$c->req->action('index'); |
|
53
|
27
|
|
|
|
|
592
|
$c->req->match( $c->req->path ); |
|
54
|
27
|
|
|
|
|
84
|
return 1; |
|
55
|
27
|
|
|
|
|
86
|
} |
|
56
|
27
|
|
|
|
|
146
|
return 0; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
0
|
|
|
|
|
0
|
|
|
59
|
|
|
|
|
|
|
=head2 $self->register( $c, $action ) |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Register an action with this DispatchType. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my ( $self, $c, $action ) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$self->_actions->{ $action->reverse } = $action if $action->name eq 'index'; |
|
68
|
44564
|
|
|
44564
|
1
|
73382
|
|
|
69
|
|
|
|
|
|
|
return 1; |
|
70
|
44564
|
100
|
|
|
|
931648
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
44564
|
|
|
|
|
97859
|
=head2 $self->uri_for_action( $action, $captures ) |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
get a URI part for an action; always returns undef is $captures is set |
|
75
|
|
|
|
|
|
|
since index actions don't have captures |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my ( $self, $action, $captures ) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return undef if @$captures; |
|
82
|
|
|
|
|
|
|
|
|
83
|
78
|
|
|
78
|
1
|
161
|
return undef unless exists $self->_actions->{ $action->reverse }; |
|
84
|
|
|
|
|
|
|
|
|
85
|
78
|
100
|
|
|
|
240
|
return "/".$action->namespace; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
29
|
100
|
|
|
|
809
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
24
|
=head1 AUTHORS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Catalyst Contributors, see Catalyst.pm |
|
92
|
74045
|
|
|
74045
|
|
142588
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify it under |
|
96
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |