MojoX::Dispatcher::Routes(3) Routes Dispatcher

SYNOPSIS


use MojoX::Dispatcher::Routes;
# New dispatcher
my $dispatcher = MojoX::Dispatcher::Routes->new;
# Dispatch
$dispatcher->dispatch(MojoX::Dispatcher::Routes::Controller->new);

DESCRIPTION

MojoX::Dispatcher::Routes is a MojoX::Routes based dispatcher.

ATTRIBUTES

MojoX::Dispatcher::Routes inherits all attributes from MojoX::Routes and implements the following ones.

controller_base_class

    my $base    = $dispatcher->controller_base_class;
    $dispatcher = $dispatcher->controller_base_class(
        'MojoX::Dispatcher::Routes::Controller'
    );

Base class used to identify controllers, defaults to MojoX::Dispatcher::Routes::Controller.

hidden

    my $hidden  = $dispatcher->hidden;
    $dispatcher = $dispatcher->hidden(
        [qw/new attr tx render req res stash/]
    );

Methods and attributes that are hidden from the dispatcher.

namespace

    my $namespace = $dispatcher->namespace;
    $dispatcher   = $dispatcher->namespace('Foo::Bar::Controller');

Namespace to search for controllers.

METHODS

MojoX::Dispatcher::Routes inherits all methods from MojoX::Routes and implements the following ones.

auto_render

    $dispatcher->auto_render(MojoX::Dispatcher::Routes::Controller->new);

Automatic rendering.

dispatch

    my $e = $dispatcher->dispatch(
        MojoX::Dispatcher::Routes::Controller->new
    );

Match routes and dispatch.

hide

    $dispatcher = $dispatcher->hide('new');

Hide method or attribute from the dispatcher.