874963a61e4b7df06e4c57dde12dd3d919e4a16b
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType.pm
1 package Catalyst::DispatchType;
2
3 use MRO::Compat;
4 use mro 'c3';
5 use Moose; # using it to add Moose::Object to @ISA ...
6 no Moose;
7
8 =head1 NAME
9
10 Catalyst::DispatchType - DispatchType Base Class
11
12 =head1 SYNOPSIS
13
14 See L<Catalyst>.
15
16 =head1 DESCRIPTION
17
18 This is an abstract base class for Dispatch Types. 
19
20 =head1 METHODS
21
22 =head2 $self->list($c)
23
24 abstract method, to be implemented by dispatchtypes. Called to display
25 info in debug log.
26
27 =cut
28
29 sub list { }
30
31 =head2 $self->match( $c, $path )
32
33 abstract method, to be implemented by dispatchtypes. Returns true if the
34 dispatch type matches the given path
35
36 =cut
37
38 sub match { die "Abstract method!" }
39
40 =head2 $self->register( $c, $action )
41
42 abstract method, to be implemented by dispatchtypes. Takes a
43 context object and a L<Catalyst::Action> object. 
44
45 Should return true if it registers something, or false otherwise.
46
47 =cut
48
49 sub register { }
50
51 =head2 $self->uri_for_action( $action, \@captures )
52
53 abstract method, to be implemented by dispatchtypes. Takes a
54 L<Catalyst::Action> object and an arrayref of captures, and should
55 return either a URI part which if placed in $c->req->path would cause
56 $self->match to match this action and set $c->req->captures to the supplied
57 arrayref, or undef if unable to do so.
58
59 =cut
60
61 sub uri_for_action { }
62
63 =head1 AUTHOR
64
65 Matt S Trout
66 Sebastian Riedel, C<sri@cpan.org>
67
68 =head1 COPYRIGHT
69
70 This program is free software, you can redistribute it and/or modify it under
71 the same terms as Perl itself.
72
73 =cut
74
75 __PACKAGE__->meta->make_immutable;
76
77 1;