Jesse Luehrs > OX-0.13 > OX::Application::Role::RouterConfig

Download:
OX-0.13.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.13   Source   Latest Release: OX-0.14

NAME ^

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

VERSION ^

version 0.13

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 ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 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.

syntax highlighting: