Commit | Line | Data |
b96f127f |
1 | package Catalyst::DispatchType; |
2 | |
531f1ab6 |
3 | use Moose; |
4 | with 'MooseX::Emulate::Class::Accessor::Fast'; |
0fc2d522 |
5 | no Moose; |
b96f127f |
6 | |
2633d7dc |
7 | =head1 NAME |
b96f127f |
8 | |
2633d7dc |
9 | Catalyst::DispatchType - DispatchType Base Class |
b96f127f |
10 | |
2633d7dc |
11 | =head1 SYNOPSIS |
12 | |
13 | See L<Catalyst>. |
14 | |
15 | =head1 DESCRIPTION |
16 | |
26dc649a |
17 | This is an abstract base class for Dispatch Types. |
18 | |
19 | From a code perspective, dispatch types are used to find which actions |
20 | to call for a given request URL. Website authors will typically work |
21 | with them via subroutine names attributes; a description of dispatch |
22 | at the attribute/URL level is given in L<Catalyst::Manual::Intro>. |
a486ab55 |
23 | |
2633d7dc |
24 | =head1 METHODS |
25 | |
b5ecfcf0 |
26 | =head2 $self->list($c) |
a9cbd748 |
27 | |
4ab87e27 |
28 | abstract method, to be implemented by dispatchtypes. Called to display |
29 | info in debug log. |
30 | |
a9cbd748 |
31 | =cut |
32 | |
33 | sub list { } |
34 | |
b5ecfcf0 |
35 | =head2 $self->match( $c, $path ) |
2633d7dc |
36 | |
4ab87e27 |
37 | abstract method, to be implemented by dispatchtypes. Returns true if the |
38 | dispatch type matches the given path |
39 | |
2633d7dc |
40 | =cut |
41 | |
42 | sub match { die "Abstract method!" } |
43 | |
b5ecfcf0 |
44 | =head2 $self->register( $c, $action ) |
2633d7dc |
45 | |
4ab87e27 |
46 | abstract method, to be implemented by dispatchtypes. Takes a |
ac5c933b |
47 | context object and a L<Catalyst::Action> object. |
4ab87e27 |
48 | |
49 | Should return true if it registers something, or false otherwise. |
50 | |
2633d7dc |
51 | =cut |
52 | |
a9cbd748 |
53 | sub register { } |
2633d7dc |
54 | |
ea0e58d9 |
55 | =head2 $self->uri_for_action( $action, \@captures ) |
56 | |
57 | abstract method, to be implemented by dispatchtypes. Takes a |
58 | L<Catalyst::Action> object and an arrayref of captures, and should |
59 | return either a URI part which if placed in $c->req->path would cause |
60 | $self->match to match this action and set $c->req->captures to the supplied |
61 | arrayref, or undef if unable to do so. |
62 | |
63 | =cut |
64 | |
65 | sub uri_for_action { } |
66 | |
ae0e35ee |
67 | =head2 $self->expand_action |
68 | |
69 | Default fallback, returns nothing. See L<Catalyst::Dispatcher> for more info |
70 | about expand_action. |
71 | |
72 | =cut |
73 | |
52f71256 |
74 | sub expand_action { } |
75 | |
2f381252 |
76 | =head1 AUTHORS |
2633d7dc |
77 | |
2f381252 |
78 | Catalyst Contributors, see Catalyst.pm |
2633d7dc |
79 | |
80 | =head1 COPYRIGHT |
81 | |
82 | This program is free software, you can redistribute it and/or modify it under |
83 | the same terms as Perl itself. |
84 | |
85 | =cut |
b96f127f |
86 | |
e5ecd5bc |
87 | __PACKAGE__->meta->make_immutable; |
88 | |
b96f127f |
89 | 1; |