Dancer2::Core::Dispatcher(3pm) | User Contributed Perl Documentation | Dancer2::Core::Dispatcher(3pm) |
Dancer2::Core::Dispatcher - Class for dispatching request to the appropriate route handler
version 0.400001
use Dancer2::Core::Dispatcher; # Create an instance of dispatcher my $dispatcher = Dancer2::Core::Dispatcher->new( apps => [$app] ); # Dispatch a request my $resp = $dispatcher->dispatch($env)->to_psgi; # Capture internal error of a response (if any) after a dispatch $dispatcher->response_internal_error($app, $error); # Capture response not found for an application the after dispatch $dispatcher->response_not_found($env);
The apps is an array reference to Dancer2::Core::App.
The default_content_type is a string which represents the context of the request. This attribute is read-only.
The "dispatch" method accepts the list of applications, hash reference for the env attribute of Dancer2::Core::Request and optionally the request object and an env as input arguments.
"dispatch" returns a response object of Dancer2::Core::Response.
Any before hook and matched route code is wrapped to allow DSL keywords such as forward and redirect to short-circuit remaining code, returning across multiple stack frames without having to throw an exception.
The "response_internal_error" takes as input the list of applications and a variable error and returns an object of Dancer2::Core::Error.
The "response_not_found" consumes as input the list of applications and an object of type Dancer2::Core::App and returns an object Dancer2::Core::Error.
Dancer Core Developers
This software is copyright (c) 2023 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2023-02-10 | perl v5.36.0 |