Slick/Router.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Slick/Methods.pm ↑ Summary
1 package Slick::Router;
2  
3 1 ▶use 5.036;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Slick::Methods qw(METHODS);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Slick::Events qw(EVENTS);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 with 'Slick::EventHandler';
10 1 with 'Slick::RouteManager';
11  
12 1 1;
13  
14 =encoding utf8
15  
16 =head1 NAME
17  
18 Slick::RouteMap
19  
20 =head1 SYNOPSIS
21  
22 L<Slick::Router> is a L<Slick::EventHandler> and a L<Slick::RouteManager>.
23  
24 It is the primary object for defining routes, outside of the main L<Slick> instance. If you want to spread
25 routing logic out across multiple files, you'll want to export a L<Slick::Router> from each module you
26 want to contain routing logic.
27  
28 =head1 Example
29  
30 my $router = Slick::Router->new(base => '/foo'); # All routes will start with /foo
31
32 my $slick = Slick->new;
33  
34 $router->get('/bob' => sub { my ($app, $context) = @_; $context->json({hello => 'world'}); });
35  
36 # You may also add events that will be dispatched between global and route level events as well.
37 $router->on(before_dispatch => sub { my ($app, $context) = @_; return 1; });
38  
39 $slick->register($router); # Register router with your Slick application
40  
41 =head1 API
42  
43 See L<Slick::EventHandler> and L<Slick::RouteManager>.
44  
45 =head1 See also
46  
47 =over 2
48  
49 =item * L<Slick>
50  
51 =item * L<Slick::RouteManager>
52  
53 =item * L<Slick::Context>
54  
55 =item * L<Slick::Database>
56  
57 =item * L<Slick::DatabaseExecutor>
58  
59 =item * L<Slick::DatabaseExecutor::MySQL>
60  
61 =item * L<Slick::DatabaseExecutor::Pg>
62  
63 =item * L<Slick::EventHandler>
64  
65 =item * L<Slick::Events>
66  
67 =item * L<Slick::Methods>
68  
69 =item * L<Slick::RouteMap>
70  
71 =item * L<Slick::Util>
72  
73 =back
74  
75 =cut
« Slick/Methods.pm ↑ Summary