fb4d0affed12e3676da9191d1cd11a1a02a32df1
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType.pm
1 package Catalyst::DispatchType;
2
3 use Moose;
4 with 'MooseX::Emulate::Class::Accessor::Fast';
5 no Moose;
6
7 =head1 NAME
8
9 Catalyst::DispatchType - DispatchType Base Class
10
11 =head1 SYNOPSIS
12
13 See L<Catalyst>.
14
15 =head1 DESCRIPTION
16
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>.
23
24 =head1 METHODS
25
26 =head2 $self->list($c)
27
28 abstract method, to be implemented by dispatchtypes. Called to display
29 info in debug log.
30
31 =cut
32
33 sub list { }
34
35 =head2 $self->match( $c, $path )
36
37 abstract method, to be implemented by dispatchtypes. Returns true if the
38 dispatch type matches the given path
39
40 =cut
41
42 sub match { die "Abstract method!" }
43
44 =head2 $self->register( $c, $action )
45
46 abstract method, to be implemented by dispatchtypes. Takes a
47 context object and a L<Catalyst::Action> object. 
48
49 Should return true if it registers something, or false otherwise.
50
51 =cut
52
53 sub register { }
54
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
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
74 sub expand_action { }
75
76 =head1 AUTHORS
77
78 Catalyst Contributors, see Catalyst.pm
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
86
87 __PACKAGE__->meta->make_immutable;
88
89 1;