| 1 | package Kelp::Less; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use Kelp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use Kelp::Base -strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our @EXPORT = qw/ | |||||||||
| 7 | app | ||||||||||
| 8 | attr | ||||||||||
| 9 | config | ||||||||||
| 10 | del | ||||||||||
| 11 | debug | ||||||||||
| 12 | error | ||||||||||
| 13 | get | ||||||||||
| 14 | module | ||||||||||
| 15 | named | ||||||||||
| 16 | param | ||||||||||
| 17 | post | ||||||||||
| 18 | put | ||||||||||
| 19 | req | ||||||||||
| 20 | res | ||||||||||
| 21 | route | ||||||||||
| 22 | run | ||||||||||
| 23 | session | ||||||||||
| 24 | stash | ||||||||||
| 25 | template | ||||||||||
| 26 | view | ||||||||||
| 27 | /; | ||||||||||
| 28 | |||||||||||
| 29 | 2 | our $app; | |||||||||
| 30 | |||||||||||
| 31 | sub import | ||||||||||
| 32 | 2 | ▶ | { | ||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||
| 33 | 2 | my $class = shift; | |||||||||
| 34 | 2 | my $caller = caller; | |||||||||
| 35 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 2 | for my $sub (@EXPORT) { | |||||||||
| 37 | 40 | *{"${caller}::$sub"} = eval("\\\&$sub"); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 2 | strict->import; | |||||||||
| 41 | 2 | warnings->import; | |||||||||
| 42 | 2 | feature->import(':5.10'); | |||||||||
| 43 | |||||||||||
| 44 | 2 | $app = Kelp->new(config_module => 'Config::Less', @_); | |||||||||
| 45 | 2 | $app->routes->base('main'); | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | sub route | ||||||||||
| 49 | 17 | ▶ | { | ||||||||
|
Subroutine
route: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 50 | 17 | my ($path, $to) = @_; | |||||||||
| 51 | 17 | $app->add_route($path, $to); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | sub get | ||||||||||
| 55 | 2 | ▶ | { | ||||||||
|
Subroutine
get: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 56 | 2 | my ($path, $to) = @_; | |||||||||
| 57 | 2 | ▶ | route ref($path) ? $path : [GET => $path], $to; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | sub post | ||||||||||
| 61 | 1 | ▶ | { | ||||||||
|
Subroutine
post: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 62 | 1 | my ($path, $to) = @_; | |||||||||
| 63 | 1 | ▶ | route ref($path) ? $path : [POST => $path], $to; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | sub put | ||||||||||
| 67 | 1 | ▶ | { | ||||||||
|
Subroutine
put: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 68 | 1 | my ($path, $to) = @_; | |||||||||
| 69 | 1 | ▶ | route ref($path) ? $path : [PUT => $path], $to; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | sub del | ||||||||||
| 73 | 1 | ▶ | { | ||||||||
|
Subroutine
del: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 74 | 1 | my ($path, $to) = @_; | |||||||||
| 75 | 1 | ▶ | route ref($path) ? $path : [DELETE => $path], $to; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | sub run | ||||||||||
| 79 | 1 | ▶ | { | ||||||||
|
Subroutine
run: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 80 | |||||||||||
| 81 | # If we're running a test, then return the entire app, | ||||||||||
| 82 | # otherwise return the PSGI subroutine | ||||||||||
| 83 | 1 | ▶ | return $ENV{KELP_TESTING} ? $app : $app->run; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 3 | ▶ | sub app { $app } | ||||||||
|
Subroutine
app: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | 2 | ▶ | sub attr { Kelp::Base::attr(ref($app), @_) } | ||||||||
|
Subroutine
attr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 88 | 2 | ▶ | sub param { $app->param(@_) } | ||||||||
|
Subroutine
param: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 89 | 0 | ▶ | sub session { $app->session(@_) } | ||||||||
|
Subroutine
session: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 90 | 2 | ▶ | sub stash { $app->stash(@_) } | ||||||||
|
Subroutine
stash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 91 | 1 | ▶ | sub named { $app->named(@_) } | ||||||||
|
Subroutine
named: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 92 | 1 | ▶ | sub req { $app->req } | ||||||||
|
Subroutine
req: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 93 | 1 | ▶ | sub res { $app->res } | ||||||||
|
Subroutine
res: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 94 | 1 | ▶ | sub template { $app->res->template(@_) } | ||||||||
|
Subroutine
template: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 95 | 0 | ▶ | sub view { $app->res->template(@_) } | ||||||||
|
Subroutine
view: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 96 | 0 | ▶ | sub debug { $app->debug(@_) if $app->can('debug') } | ||||||||
|
Subroutine
debug: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 97 | 0 | ▶ | sub error { $app->error(@_) if $app->can('error') } | ||||||||
|
Subroutine
error: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 98 | 2 | ▶ | sub module { $app->load_module(@_) } | ||||||||
|
Subroutine
module: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 99 | 1 | ▶ | sub config { $app->config(@_) } | ||||||||
|
Subroutine
config: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 100 | |||||||||||
| 101 | 2 | 1; | |||||||||
| 102 | |||||||||||
| 103 | __END__ | ||||||||||