The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OX::RouteBuilder - abstract role for classes that turn configuration into a route

VERSION

version 0.14

DESCRIPTION

This is an abstract role which is used to turn simplified and easy to understand routing descriptions into actual routes that the router understands. Currently, the API is a bit specific to Path::Router.

For usable examples, see OX::RouteBuilder::ControllerAction, OX::RouteBuilder::HTTPMethod, and OX::RouteBuilder::Code.

ATTRIBUTES

path

The path that this route is for. Required.

route_spec

The route_spec that describes how this path should be routed. See OX::Application::Role::RouteBuilder. Required.

params

The defaults and validations for this path. See Path::Router for more information. Required.

METHODS

compile_routes($app)

This is a required method which should generate a list of routes based on the contents of the object. Each route should be a hashref with these keys:

path

Path specification for the route.

target

Coderef to call to handle the request.

defaults

Extra values which will be included in the resulting match.

validations

Validation rules for variable path components. See Path::Router for more information.

parse_action_spec($action_spec)

Required class method which should take the actual action specification provided in the user's router description and return either a route_spec that can be understood by OX::Application::Role::RouteBuilder or undef (if the action spec wasn't of the form that could be understood by this class).

extract_defaults_and_validations

Helper method which sorts the params into defaults and validations.

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.