OX::Application::Role::RouterConfig - adds some common shortcuts to route declarations from OX::Application::Role::RouteBuilder
version 0.14
package MyApp; use Moose; use Bread::Board; extends 'OX::Application'; with 'OX::Application::Role::RouterConfig', 'OX::Application::Role::Router::Path::Router'; sub BUILD { my $self = shift; container $self => as { service root => ( class => 'Foo::Root', ); service 'RouterConfig' => ( block => sub { +{ '/' => { controller => 'root', action => 'index', }, '/foo' => sub { 'FOO' }, } }, ); }; }
This role overrides parse_route in OX::Application::Role::RouteBuilder to provide some nicer syntax. If a value in your router config contains the controller and action keys, it will extract those out and automatically construct an OX::RouteBuilder::ControllerAction for you. If the value is a single coderef, it will automatically construct an OX::RouteBuilder::Code for you.
parse_route
controller
action
Stevan Little <stevan.little@iinteractive.com>
Jesse Luehrs <doy@tozt.net>
This software is copyright (c) 2014 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install OX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OX
CPAN shell
perl -MCPAN -e shell install OX
For more information on module installation, please visit the detailed CPAN module installation guide.