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.300005
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 to allow DSL keywords
44 such as forward and redirect to short-circuit remaining code, returning
45 across multiple stack frames without having to throw an exception.
46
47 response_internal_error
48 The "response_internal_error" takes as input the list of applications
49 and a variable error and returns an object of Dancer2::Core::Error.
50
51 response_not_found
52 The "response_not_found" consumes as input the list of applications and
53 an object of type Dancer2::Core::App and returns an object
54 Dancer2::Core::Error.
55
57 Dancer Core Developers
58
60 This software is copyright (c) 2021 by Alexis Sukrieh.
61
62 This is free software; you can redistribute it and/or modify it under
63 the same terms as the Perl 5 programming language system itself.
64
65
66
67perl v5.32.1 2021-01-31 Dancer2::Core::Dispatcher(3)