blib/lib/Kelp.pm

filter: Statementstmt 96.9% 188 / 194 Branchbran 79.6% 43 / 54 Conditioncond 71.0% 27 / 38 MC/DCmcdc 45.0% 9 / 20 Subroutinesub 94.3% 50 / 53 Podpod 92.0% 23 / 25 totaltotal 88.5% 340 / 384 CC 41 SCAR 14.1
CC
41
Cov
90%
handle_exception
10.3
_psgi_internal
10.0
new_anon
8.6
CRAP 4.1
« blib/lib/Kelp/Routes/Pattern.pm ↑ Summary blib/lib/Kelp/Module/Template.pm »
1 package Kelp;
2  
3 41 ▶use Kelp::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 41 ▶use Carp qw/ longmess croak /;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 41 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 41 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 41 ▶use Sys::Hostname;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 41 ▶use Plack::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 41 ▶use Class::Inspector;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 41 ▶use List::Util qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 41 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 41 our $VERSION = '2.23';
15  
16 # Basic attributes
17 41 attr -host => hostname;
18 41 ▶attr mode => $ENV{KELP_ENV} // $ENV{PLACK_ENV} // 'development';
Condition80%4/5
($ENV{"KELP_ENV"} // $ENV{"PLACK_ENV"}) // "development"
l!l
140
$ENV{"KELP_ENV"} // $ENV{"PLACK_ENV"}
l!l&&r!l&&!r
0140
MC/DC50%1/2
($ENV{"KELP_ENV"} // $ENV{"PLACK_ENV"}) // "development"
$ENV{"KELP_ENV"} $ENV{"PLACK_ENV"}
Truth table66%2/3
A // B
A= $ENV{"KELP_ENV"}B= $ENV{"PLACK_ENV"}
ABresult
1X1
011
000
19 41 attr -path => $FindBin::Bin;
20 0 ▶attr -name => sub { (ref($_[0]) =~ /(\w+)$/) ? $1 : 'Noname' };
Subroutine __ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
ref($_[0]) =~ /(\w+)$/ ? : 0 0 0
21 41 attr request_obj => 'Kelp::Request';
22 41 attr response_obj => 'Kelp::Response';
23 41 attr context_obj => 'Kelp::Context';
24 41 attr middleware_obj => 'Kelp::Middleware';
25  
26 # Debug
27 41 ▶attr long_error => $ENV{KELP_LONG_ERROR} // 0;
Condition50%1/2
$ENV{"KELP_LONG_ERROR"} // 0
l!l
041
MC/DC0%0/1
$ENV{"KELP_LONG_ERROR"} // 0
$ENV{"KELP_LONG_ERROR"}
Truth table50%1/2
A
A= $ENV{"KELP_LONG_ERROR"}
Aresult
11
00
28  
29 # The charset is set to UTF-8 by default in config module.
30 # No default here because we want to support 'undef' charset
31 31 ▶attr charset => sub { $_[0]->config('charset') };
Subroutine __ANON__: called CC=1 SCAR=0.0
32 33 ▶attr request_charset => sub { $_[0]->config('request_charset') };
Subroutine __ANON__: called CC=1 SCAR=0.0
33  
34 # Name the config module
35 41 attr config_module => 'Config';
36  
37 # Undocumented.
38 # Used to unlock the undocumented features of the Config module.
39 41 attr __config => undef;
40  
41 55 ▶attr -loaded_modules => sub { {} };
Subroutine __ANON__: called CC=1 SCAR=0.0
42  
43 # Current context of the application - tracks the state application is in,
44 # especially when it comes to managing controller instances.
45 41 attr context => \&build_context;
46  
47 # registered application encoder modules
48 48 ▶attr encoder_modules => sub { {} };
Subroutine __ANON__: called CC=1 SCAR=0.0
49  
50 # Initialization
51 sub new
52 55 ▶{
Subroutine new: called CC=3 SCAR=11.0
Pod documented
53 55 my $self = shift->SUPER::new(@_);
54  
55 55 Kelp::Util::_DEBUG(1 => 'Loading essential modules...');
56  
57 # Always load these modules, but allow client to override
58 55 $self->_load_config();
59 54 $self->_load_routes();
60  
61 54 Kelp::Util::_DEBUG(1 => 'Loading modules from config...');
62  
63 # Load the modules from the config
64 54 ▶ if (defined(my $modules = $self->config('modules'))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $modules = $self->config("modules"))) 52 2 54
65 52 $self->load_module($_) for (@$modules);
66 }
67  
68 54 Kelp::Util::_DEBUG(1 => 'Calling build method...');
69  
70 54 $self->build();
71 54 return $self;
72 }
73  
74 sub new_anon
75 6 ▶{
Subroutine new_anon: called CC=8 SCAR=21.5
Pod documented
76 6 state $last_anon = 0;
77 6 my $class = shift;
78  
79 # make sure we don't eval something dodgy
80 6 ▶ die "invalid class for new_anon"
Branch: 1 branch
BranchTrueFalseTotal
if ref $class or not $class or not "Class::Inspector"->loaded($class) or not $class->isa(__PACKAGE__) 2 4 6
Condition77%7/9
ref $class or not $class or not "Class::Inspector"->loaded($class) or not $class->isa(__PACKAGE__)
l!l&&r!l&&!r
204
ref $class or not $class or not "Class::Inspector"->loaded($class)
l!l&&r!l&&!r
114
ref $class or not $class
l!l&&r!l&&!r
015
MC/DC50%2/4
ref $class or not $class or not "Class::Inspector"->loaded($class) or not $class->isa(__PACKAGE__)
ref $class not $class not "Class::Inspector"->loaded($class) not $class->isa(__PACKAGE__)
Truth table60%3/5
A or not(B) or not(C) or not(D)
A= ref $classB= not $classC= not "Class::Inspector"->loaded($class)D= not $class->isa(__PACKAGE__)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
81 if ref $class # not a string
82 || !$class # not an empty string, undef or 0
83 || !Class::Inspector->loaded($class) # not a loaded class
84 || !$class->isa(__PACKAGE__) # not a correct class
85 ;
86  
87 4 my $anon_class = "Kelp::Anonymous::$class" . ++$last_anon;
88 4 my $err = do {
89 4 local $@;
90 4 ▶ my $eval_status = eval qq[
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
91 {
92 package $anon_class;
93 use parent -norequire, '$class';
94  
95 sub _real_class { '$class' }
96 }
97 1;
98 ];
99 4 ▶ $@ || !$eval_status;
Condition33%1/3
$@ || !$eval_status
l!l&&r!l&&!r
004
MC/DC0%0/2
$@ || !$eval_status
$@ !$eval_status
Truth table33%1/3
A || not(B)
A= $@B= !$eval_status
ABresult
1X1
011
000
100 };
101  
102 4 ▶ if ($err) {
Branch: 1 branch
BranchTrueFalseTotal
if ($err) 0 4 4
103 0 ▶ die "Couldn't create anonymous Kelp instance: " .
Branch: 1 branch
BranchTrueFalseTotal
length $err > 1 ? : 0 0 0
104 (length $err > 1 ? $err : 'unknown error');
105 }
106  
107 4 return $anon_class->new(@_);
108 }
109  
110 sub _load_config
111 57 ▶{
Subroutine _load_config: called CC=1 SCAR=0.0
112 57 my $self = shift;
113 56 $self->load_module($self->config_module, extra => $self->__config);
114  
115 55 Kelp::Util::_DEBUG(config => 'Merged configuration: ', $self->config_hash);
116 }
117  
118 sub _load_routes
119 55 ▶{
Subroutine _load_routes: called CC=1 SCAR=0.0
120 54 my $self = shift;
121 54 $self->load_module('Routes');
122 }
123  
124 # Create a shallow copy of the app, optionally blessed into a
125 # different subclass.
126 sub _clone
127 18 ▶{
Subroutine _clone: called CC=3 SCAR=12.0
128 17 my $self = shift;
129 17 ▶ my $subclass = shift || ref($self);
Condition33%1/3
shift() || ref $self
l!l&&r!l&&!r
1700
MC/DC0%0/2
shift() || ref $self
shift() ref $self
Truth table33%1/3
A || B
A= shift()B= ref $self
ABresult
1X1
011
000
130  
131 17 ▶ ref $self or croak '_clone requires instance';
Branch: 1 branch
BranchTrueFalseTotal
ref $self or croak("_clone requires instance") 17 0 17
132 17 return bless {%$self}, $subclass;
133 }
134  
135 sub load_module
136 215 ▶{
Subroutine load_module: called CC=5 SCAR=16.1
Pod documented
137 215 my ($self, $name, %args) = @_;
138  
139 # A module name with a leading + indicates it's already fully
140 # qualified (i.e., it does not need the Kelp::Module:: prefix).
141 215 ▶ my $prefix = $name =~ s/^\+// ? undef : 'Kelp::Module';
Branch: 1 branch
BranchTrueFalseTotal
$name =~ s/^\+// ? : 1 214 215
142  
143 # Make sure the module was not already loaded
144 215 ▶ return if $self->loaded_modules->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $self->loaded_modules->{$name} 0 215 215
145  
146 215 my $class = Plack::Util::load_class($name, $prefix);
147 214 my $module = $self->loaded_modules->{$name} = $class->new(app => $self);
148  
149 # When loading the Config module itself, we don't have
150 # access to $self->config yet. This is why we check if
151 # config is available, and if it is, then we pull the
152 # initialization hash.
153 214 my $args_from_config = {};
154 214 ▶ if ($self->can('config')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("config")) 172 42 214
155 172 ▶ $args_from_config = $self->config("modules_init.$name") // {};
Condition100%2/2
$self->config("modules_init.$name") // {}
l!l
15121
MC/DC100%1/1
$self->config("modules_init.$name") // {}
$self->config("modules_init.$name")
Truth table100%2/2
A
A= $self->config("modules_init.$name")
Aresult
11
00
156 }
157  
158 214 Kelp::Util::_DEBUG(modules => "Loading $class module with args: ", {%$args_from_config, %args});
159  
160 214 $module->build(%$args_from_config, %args);
161 213 return $module;
162 }
163  
164 # Override this one to add custom initializations
165 sub build
166 43 ▶{
Subroutine build: called CC=1 SCAR=0.0
Pod documented
167 }
168  
169 # Override to use a custom context object
170 sub build_context
171 33 ▶{
Subroutine build_context: called CC=1 SCAR=0.0
Pod documented
172 33 return Kelp::Util::load_package($_[0]->context_obj)->new(
173 app => $_[0],
174 );
175 }
176  
177 # Override to use a custom request object
178 sub build_request
179 261 ▶{
Subroutine build_request: called CC=1 SCAR=0.0
Pod documented
180 261 return Kelp::Util::load_package($_[0]->request_obj)->new(
181 app => $_[0],
182 env => $_[1],
183 );
184 }
185  
186 sub req
187 662 ▶{
Subroutine req: called CC=1 SCAR=0.0
Pod documented
188 662 my $self = shift;
189 662 return $self->context->req(@_);
190 }
191  
192 # Override to use a custom response object
193 sub build_response
194 255 ▶{
Subroutine build_response: called CC=1 SCAR=0.0
Pod documented
195 255 return Kelp::Util::load_package($_[0]->response_obj)->new(
196 app => $_[0],
197 );
198 }
199  
200 sub res
201 1136 ▶{
Subroutine res: called CC=1 SCAR=0.0
Pod documented
202 1136 my $self = shift;
203 1136 return $self->context->res(@_);
204 }
205  
206 # Override to change what happens before the route is handled
207 sub before_dispatch
208 270 ▶{
Subroutine before_dispatch: called CC=2 SCAR=6.9
Pod documented
209 270 my ($self, $destination) = @_;
210  
211 # Log info about the route
212 270 ▶ if ($self->can('logger')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("logger")) 1 269 270
213 1 my $req = $self->req;
214  
215 1 $self->info(
216 sprintf "%s: %s - %s %s - %s",
217 ref $self,
218 $req->address, $req->method,
219 $req->path, $destination
220 );
221 }
222 }
223  
224 # Override to change what happens when nothing gets rendered
225 sub after_unrendered
226 8 ▶{
Subroutine after_unrendered: called CC=2 SCAR=6.9
Pod documented
227 8 my ($self, $match) = @_;
228  
229 # render 404 if only briges matched
230 8 ▶ if ($match->[-1]->bridge) {
Branch: 1 branch
BranchTrueFalseTotal
if ($match->[-1]->bridge) { } 5 3 8
231 5 $self->res->render_404;
232 }
233  
234 # or die with error
235 else {
236 3 die $match->[-1]->to
237 . " did not render for method "
238 . $self->req->method;
239 }
240 }
241  
242 # Override to manipulate the end response
243 sub before_finalize
244 232 ▶{
Subroutine before_finalize: called CC=1 SCAR=0.0
Pod documented
245 232 my $self = shift;
246 232 $self->res->header('X-Framework' => 'Perl Kelp');
247 }
248  
249 # Override this to wrap more middleware around the app
250 sub run
251 257 ▶{
Subroutine run: called CC=1 SCAR=0.0
Pod documented
252 257 my $self = shift;
253 257 ▶ my $app = sub { $self->psgi(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
254  
255 257 Kelp::Util::_DEBUG(1 => 'Running the application...');
256  
257 257 my $middleware = Kelp::Util::load_package($self->middleware_obj)->new(
258 app => $self,
259 );
260  
261 257 return $middleware->wrap($app);
262 }
263  
264 sub _psgi_internal
265 252 ▶{
Subroutine _psgi_internal: called CC=10 SCAR=23.0
266 252 my ($self, $match) = @_;
267 252 my $req = $self->req;
268 252 my $res = $self->res;
269  
270 # Go over the entire route chain
271 252 for my $route (@$match) {
272  
273 # Dispatch
274 275 $req->named($route->named);
275 275 $req->route_name($route->name);
276 275 my $data = $self->routes->dispatch($self, $route);
277  
278 238 ▶ if ($route->bridge) {
Branch: 2 branches
BranchTrueFalseTotal
if ($route->bridge) { } 33 205 238
elsif (defined $data) { } 189 16 205
279  
280 # Is it a bridge? Bridges must return a true value to allow the
281 # rest of the routes to run. They may also have rendered
282 # something, in which case trust that and don't render 403 (but
283 # still end the execution chain)
284  
285 33 ▶ if (!$data) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($data) 4 29 33
286 4 ▶ $res->render_403 unless $res->rendered;
Branch: 1 branch
BranchTrueFalseTotal
unless $res->rendered 2 2 4
287 }
288 }
289 elsif (defined $data) {
290  
291 # If the non-bridge route returned something, then analyze it and render it
292  
293 # Handle delayed response if CODE
294 189 ▶ return $data if ref $data eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $data eq "CODE" 1 188 189
295 188 ▶ $res->render($data) unless $res->rendered;
Branch: 1 branch
BranchTrueFalseTotal
unless $res->rendered 148 40 188
296 }
297  
298 # Do not go any further if we got a render
299 233 ▶ last if $res->rendered;
Branch: 1 branch
BranchTrueFalseTotal
if $res->rendered 201 32 233
300 }
301  
302 # If nothing got rendered
303 210 ▶ if (!$res->rendered) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($res->rendered) 9 201 210
304 9 $self->context->run_method(after_unrendered => ($match));
305 }
306  
307 207 return $self->finalize;
308 }
309  
310 sub NEXT_APP
311 269 ▶{
Subroutine NEXT_APP: called CC=1 SCAR=0.0
Pod documented
312 270 ▶ return sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
313 270 (shift @{$_[0]->{'kelp.execution_chain'}})->($_[0]);
314 269 };
315 }
316  
317 sub psgi
318 260 ▶{
Subroutine psgi: called CC=2 SCAR=6.9
Pod undocumented
319 260 my ($self, $env) = @_;
320  
321 # Initialize the app object state
322 260 $self->context->clear;
323 260 my $req = $self->req($self->build_request($env));
324 260 my $res = $self->res($self->build_response);
325  
326 # Get route matches
327 260 my $match = $self->routes->match($req->path, $req->method);
328  
329 # None found? Short-circuit and show 404
330 260 ▶ if (!@$match) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$match) 8 252 260
331 8 $res->render_404;
332 8 return $self->finalize;
333 }
334  
335 252 ▶ return try {
Subroutine __ANON__: called CC=1 SCAR=0.0
336 $env->{'kelp.execution_chain'} = [
337 280 (grep { defined } map { $_->psgi_middleware } @$match),
338 252 ▶ sub { $self->_psgi_internal($match) },
Subroutine __ANON__: called CC=1 SCAR=0.0
339 252 ];
340  
341 252 return Kelp->NEXT_APP->($env);
342 }
343 44 ▶ catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
344 44 my $exception = $_;
345 44 return $self->context->run_method(handle_exception => ($exception));
346 252 };
347 }
348  
349 # Override to change what happens when a route dies
350 sub handle_exception
351 41 ▶{
Subroutine handle_exception: called CC=10 SCAR=23.4
Pod documented
352 41 my ($self, $exception) = @_;
353 41 my $res = $self->res;
354  
355 # Exceptions which know how to turn themselves into a PSGI response (the
356 # convention used by Plack::Middleware::HTTPExceptions and Catalyst) are
357 # meant to be handled by a middleware: rethrow them
358 41 ▶ die $exception
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($exception) and not $exception->isa("Kelp::Exception") and $exception->can("as_psgi") 3 38 41
Condition100%6/6
builtin::blessed($exception) and not $exception->isa("Kelp::Exception") and $exception->can("as_psgi")
!ll&&!rl&&r
2993
builtin::blessed($exception) and not $exception->isa("Kelp::Exception")
!ll&&!rl&&r
181112
MC/DC100%3/3
builtin::blessed($exception) and not $exception->isa("Kelp::Exception") and $exception->can("as_psgi")
builtin::blessed($exception) not $exception->isa("Kelp::Exception") $exception->can("as_psgi")
Truth table100%4/4
A and not(B) and C
A= builtin::blessed($exception)B= not $exception->isa("Kelp::Exception")C= $exception->can("as_psgi")
ABCresult
0XX0
10X0
1100
1111
359 if blessed $exception
360 && !$exception->isa('Kelp::Exception')
361 && $exception->can('as_psgi');
362  
363 # CONTEXT CHANGE: we need to clear response state because anything that
364 # was rendered beforehand is no longer valid. Body and code will be
365 # replaced automatically with render methods, but headers must be
366 # cleared explicitly
367 38 $res->headers->clear;
368  
369 38 ▶ if (blessed $exception && $exception->isa('Kelp::Exception')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($exception) and $exception->isa('Kelp::Exception')) { } 11 27 38
Condition100%3/3
builtin::blessed($exception) and $exception->isa("Kelp::Exception")
!ll&&!rl&&r
18911
MC/DC100%2/2
builtin::blessed($exception) and $exception->isa("Kelp::Exception")
builtin::blessed($exception) $exception->isa("Kelp::Exception")
Truth table100%3/3
A and B
A= builtin::blessed($exception)B= $exception->isa("Kelp::Exception")
ABresult
0X0
100
111
370  
371 # only log it as an error if the body is present
372 11 ▶ $self->logger('error', $exception->body)
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("logger") and defined $exception->body 0 11 11
Condition33%1/3
$self->can("logger") and defined $exception->body
!ll&&!rl&&r
1100
MC/DC0%0/2
$self->can("logger") and defined $exception->body
$self->can("logger") defined $exception->body
Truth table33%1/3
A and B
A= $self->can("logger")B= defined $exception->body
ABresult
0X0
100
111
373 if $self->can('logger') && defined $exception->body;
374  
375 11 $res->render_exception($exception);
376 }
377 else {
378 27 ▶ my $message = $self->long_error ? longmess($exception) : $exception;
Branch: 1 branch
BranchTrueFalseTotal
$self->long_error ? : 0 27 27
379  
380 # Log error
381 27 ▶ $self->logger('critical', $message) if $self->can('logger');
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("logger") 0 27 27
382  
383 # Render an application erorr (hides details on production)
384 27 $res->render_500($exception);
385 }
386  
387 38 return $self->finalize;
388 }
389  
390 sub finalize
391 254 ▶{
Subroutine finalize: called CC=1 SCAR=0.0
Pod undocumented
392 254 my $self = shift;
393  
394 # call it with current context, so that it will get controller's hook if
395 # possible
396 254 $self->context->run_method(before_finalize => ());
397  
398 254 return $self->res->finalize;
399 }
400  
401 #----------------------------------------------------------------
402 # Request and Response shortcuts
403 #----------------------------------------------------------------
404 sub param
405 71 ▶{
Subroutine param: called CC=1 SCAR=0.0
Pod documented
406 71 my $self = shift;
407 71 unshift @_, $self->req;
408  
409 # goto will allow carp show the correct caller
410 71 goto $_[0]->can('param');
411 }
412  
413 0 ▶sub session { shift->req->session(@_) }
Subroutine session: not called CC=1 SCAR=6.9
Pod documented
414  
415 sub stash
416 2 ▶{
Subroutine stash: called CC=2 SCAR=6.9
Pod documented
417 2 my $self = shift;
418 2 ▶ @_ ? $self->req->stash->{$_[0]} : $self->req->stash;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 1 2
419 }
420  
421 sub named
422 21 ▶{
Subroutine named: called CC=2 SCAR=7.2
Pod documented
423 21 my $self = shift;
424 21 ▶ @_ ? $self->req->named->{$_[0]} : $self->req->named;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 21 0 21
425 }
426  
427 #----------------------------------------------------------------
428 # Utility
429 #----------------------------------------------------------------
430  
431 sub is_production
432 38 ▶{
Subroutine is_production: called CC=1 SCAR=0.0
Pod documented
433 38 my $self = shift;
434 38 ▶ return any { lc $self->mode eq $_ } qw(deployment production);
Subroutine __ANON__: called CC=1 SCAR=0.0
435 }
436  
437 sub url_for
438 7 ▶{
Subroutine url_for: called CC=1 SCAR=0.0
Pod documented
439 7 my ($self, $name, @args) = @_;
440 7 my $result = $name;
441 7 ▶ try { $result = $self->routes->url($name, @args) };
Subroutine __ANON__: called CC=1 SCAR=0.0
442 7 return $result;
443 }
444  
445 sub abs_url
446 0 ▶{
Subroutine abs_url: not called CC=1 SCAR=6.9
Pod documented
447 0 my ($self, $name, @args) = @_;
448 0 my $url = $self->url_for($name, @args);
449 0 return URI->new_abs($url, $self->config('app_url'))->as_string;
450 }
451  
452 sub get_encoder
453 69 ▶{
Subroutine get_encoder: called CC=2 SCAR=7.1
Pod documented
454 69 my ($self, $type, $name) = @_;
455  
456 69 ▶ my $encoder = $self->encoder_modules->{$type} //
Condition50%1/2
$self->encoder_modules->{$type} // croak("No $type encoder")
l!l
690
MC/DC0%0/1
$self->encoder_modules->{$type} // croak("No $type encoder")
$self->encoder_modules->{$type}
Truth table50%1/2
A
A= $self->encoder_modules->{$type}
Aresult
11
00
457 croak "No $type encoder";
458  
459 69 return $encoder->get_encoder($name);
460 }
461  
462 41 1;
463  
464 __END__
« blib/lib/Kelp/Routes/Pattern.pm ↑ Summary blib/lib/Kelp/Module/Template.pm »