Eve::HttpDispatcher - an event handler for HTTP request events.
use Eve::HttpDispatcher; my $dispatcher = Eve::HttpDispatcher->new( request_constructor => $request_constructor, response => $response, base_uri => $base_uri, alias_base_uri_list => [$alias_base_uri, $another_alias_base_uri], event_map => $event_map); $dispatcher->bind( name => $name pattern => $pattern, resource_constructor => $resource_constructor); $dispatcher->bind( name => $name_404 pattern => $pattern_404, resource_constructor => $resource_constructor_404, exception => 'Eve::Exception::Http::404NotFound'); $dispatcher->handle(event => $event);
Eve::HttpDispatcher class is a central component to a web service application.
request_constructor
a code reference that returns an HTTP request object when passed an environment hash
response
an HTTP response object
event_map
an event map object.
base_uri
a base URI object used for resource binding.
alias_base_uri_list
(optional) a reference to a list of additional base URI objects that will be used for resource matching.
Binds an HTTP resource.
name
a name identifying the binding
pattern
an URI pattern string that can contain placeholders
a URI object that represents a base URL for the binding resource
resource_constructor
a code reference that returns an HTTP resource object
exception
(optional) an HTTP exception class name that the bound resource should be used to handle. Note: there can be only one resource bound to handle a certain exception.
Eve::Exception::HttpDispatcher
if either name or compound URI or exception class name is not unique.
A URI bound to the resource name.
Eve::Error::HttpDispatcher
When there is no resource with the requested name.
Chooses a resource using the request URI and delegates control to the resource's process() method. It also passes placeholder matches into this method.
process()
event
a Eve::Event::HttpRequestReceived object.
Eve::Event::HttpRequestReceived
Eve::Exception::Http::404NotFound
if no resources match the request and no resources that handle the Eve::Exception::Http::404NotFound are bound.
Copyright 2012 Igor Zinovyev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Eve, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eve
CPAN shell
perl -MCPAN -e shell install Eve
For more information on module installation, please visit the detailed CPAN module installation guide.