Anton Belousov > Eidolon > Eidolon::Driver::Router

Download:
Eidolon-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Eidolon::Driver::Router - Eidolon generic router driver.

SYNOPSIS ^

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"}  = ...;
    }

DESCRIPTION ^

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.

METHODS ^

new()

Class constructor.

find_handler()

Finds a query handler. Abstract method, should be overloaded by the ancestor class.

get_handler()

Returns a reference to the query handler subroutine.

get_params()

Returns a reference to the array of query handler parameters.

ATTRIBUTES ^

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"};

controller

Contoller class name, that was selected for request handling.

handler

Handler code reference in selected controller.

params

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.

SEE ALSO ^

Eidolon, Eidolon::Application, Eidolon::Driver::Router::Exceptions

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR ^

Anton Belousov, <abel@cpan.org>

COPYRIGHT ^

Copyright (c) 2009, Atma 7, http://www.atma7.com

syntax highlighting: