1Dancer2::Core::DispatchUesre(r3)Contributed Perl DocumenDtaantcieorn2::Core::Dispatcher(3)
2
3
4
6 Dancer2::Core::Dispatcher - Class for dispatching request to the
7 appropriate route handler
8
10 version 0.207000
11
13 use Dancer2::Core::Dispatcher;
14
15 # Create an instance of dispatcher
16 my $dispatcher = Dancer2::Core::Dispatcher->new( apps => [$app] );
17
18 # Dispatch a request
19 my $resp = $dispatcher->dispatch($env)->to_psgi;
20
21 # Capture internal error of a response (if any) after a dispatch
22 $dispatcher->response_internal_error($app, $error);
23
24 # Capture response not found for an application the after dispatch
25 $dispatcher->response_not_found($env);
26
28 apps
29 The apps is an array reference to Dancer2::Core::App.
30
31 default_content_type
32 The default_content_type is a string which represents the context of
33 the request. This attribute is read-only.
34
36 dispatch
37 The "dispatch" method accepts the list of applications, hash reference
38 for the env attribute of Dancer2::Core::Request and optionally the
39 request object and an env as input arguments.
40
41 "dispatch" returns a response object of Dancer2::Core::Response.
42
43 Any before hook and matched route code is wrapped using
44 Return::MultiLevel to allow DSL keywords such as forward and redirect
45 to short-circuit remaining code without having to throw an exception.
46 Return::MultiLevel will use Scope::Upper (an XS module) if it is
47 available.
48
49 response_internal_error
50 The "response_internal_error" takes as input the list of applications
51 and a variable error and returns an object of Dancer2::Core::Error.
52
53 response_not_found
54 The "response_not_found" consumes as input the list of applications and
55 an object of type Dancer2::Core::App and returns an object
56 Dancer2::Core::Error.
57
59 Dancer Core Developers
60
62 This software is copyright (c) 2018 by Alexis Sukrieh.
63
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66
67
68
69perl v5.28.0 2018-11-14 Dancer2::Core::Dispatcher(3)