blib/lib/Kelp/Routes/Controller.pm untested

filter: Statementstmt 0.0% 0 / 5 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 6 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
CRAP 2.0
1 package Kelp::Routes::Controller;
2  
3 use Kelp::Base 'Kelp::Routes';
4  
5 # the new Kelp::Routes does the Controller logic by itself, we just need to configure it correctly
6 attr rebless => 1;
7  
8 1;
9  
10 __END__
11  
12 =pod
13  
14 =head1 NAME
15  
16 Kelp::Routes::Controller - Legacy routes and controller for Kelp
17  
18 =head1 SYNOPSIS
19  
20 # config.pl
21 # ---------
22 {
23 modules_init => {
24 Routes => {
25 router => 'Controller',
26 base => 'MyApp::Controller',
27 }
28 }
29 }
30  
31 # MyApp/Controller.pm
32 # -------------------
33 package MyApp::Controller;
34 use Kelp::Base 'MyApp';
35  
36 sub shared_method {
37 my $self = shift; # $self is an instance of 'MyApp::Controller'
38 ...
39 }
40  
41  
42 # MyApp/Controller/Users.pm
43 # -------------------------
44 package MyApp::Controller::Users;
45 use Kelp::Base 'MyApp::Controller';
46  
47 sub read {
48 my $self = shift; # $self is an instance of 'MyApp::Controller::Users'
49 ...
50 }
51  
52  
53 =head1 DESCRIPTION
54  
55 B<< This module is no longer needed, since L<Kelp::Routes> handles reblessing
56 by itself when configured with C<rebless>. It's only here for backward
57 compatibility and documentation purposes. >>
58  
59 This router module reblesses a Kelp application into its own controller class.
60 This allows you to structure your web application in a classic object oriented
61 fashion, having C<$self> an instance to the current class rather than the main
62 web application.
63  
64 You must create a main I<controller> class which inherits from Kelp. Each
65 subsequent class can inherit from this class, taking advantage of any common
66 functionality.
67  
68  
69 =cut
70