Eidolon::Driver::Router - Eidolon generic router driver.
Example router driver:
package MyApp::Driver::Router; use base qw/Eidolon::Driver::Router/; sub find_handler { my $self = shift; # ... throw DriverError::Router::NotFound unless $handler_found; $self->{"handler"} = ...; $self->{"params"} = ...; }
The Eidolon::Driver::Router is a generic router driver for Eidolon. It declares some basic functions that are common for all driver types and one abstract method, that must be overloaded in ancestor classes. All router drivers should subclass this package.
Class constructor.
Finds a query handler. Abstract method, should be overloaded by the ancestor class.
Returns a reference to the query handler subroutine.
Returns a reference to the array of query handler parameters.
The Eidolon::Driver::Router package has got several useful class attributes that filled in during request routing. These variables could be accessed through router object using hashref syntax:
my ($r, $router, $params); $r = Eidolon::Core::Registry->get_instance; $router = $r->loader->get_object("Eidolon::Driver::Router"); $params = $router->{"params"};
Contoller class name, that was selected for request handling.
Handler code reference in selected controller.
Reference to array of handler parameters. Actually, these parameters will be passed to a request handler function, but they could be accessed this way too.
Eidolon, Eidolon::Application, Eidolon::Driver::Router::Exceptions
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Anton Belousov, <abel@cpan.org>
Copyright (c) 2009, Atma 7, http://www.atma7.com
To install Eidolon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eidolon
CPAN shell
perl -MCPAN -e shell install Eidolon
For more information on module installation, please visit the detailed CPAN module installation guide.