++ed by:
WKI KEEDI GENEHACK DOMM BINJOY

13 PAUSE users
11 non-PAUSE users.

Jesse Luehrs
and 9 contributors

NAME

OX::Application::Role::RouterConfig - adds some common shortcuts to route declarations from OX::Application::Role::RouteBuilder

VERSION

version 0.14

SYNOPSIS

  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' },
                  }
              },
          );
      };
  }

DESCRIPTION

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.

AUTHORS

  • Stevan Little <stevan.little@iinteractive.com>

  • Jesse Luehrs <doy@tozt.net>

COPYRIGHT AND LICENSE

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.