NAME
Thunderhorse::Router - Router for Thunderhorse
SYNOPSIS
my $router_obj = $app->router;
DESCRIPTION
Thunderhorse router is a class which allows adding new locations (using "add" in Gears::Router), finding locations (using "find") and matching them (using "match" in Gears::Router). It uses Thunderhorse::Router::Location as the location implementation.
INTERFACE
Inherits all interface from Gears::Router, and adds the interface documented below.
Attributes
controller
Current controller. It is set automatically when calling the router method in an app or in a controller. All locations built will use this attribute as their controller.
writer: set_controller
cache
Cache object - must have at least get, set and clear methods. If specified, all matching will be cached in that object. For best results, Thunderhorse::Router::SpecializedCache role should be mixed into the cache. This role makes sure that "location" in Gears::Router::Match will be stored as a location name in cache, not as a full Gears::Router::Location object. This way less data will be held in the cache, and if the cache is stored outside of perl memory, it will be easily mapped in a way that allows multiple servers workers to use the same cached values.
Available in constructor
writer: set_cache
Methods
new
$object = $class->new(%args)
Standard Mooish constructor. Consult "Attributes" section for available constructor arguments.
find
$location = $object->find($name)
Returns the location with the given $name. If no such location exists, returns undef.