Path::Router

A tool for routing paths
Download

Path::Router Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Stevan Little
  • Publisher web site:
  • http://search.cpan.org/~stevan/

Path::Router Tags


Path::Router Description

A tool for routing paths Path::Router is a tool for routing paths.SYNOPSIS my $router = Path::Router->new; $router->add_route('blog' => ( defaults => { controller => 'blog', action => 'index', }, # you can provide a fixed "target" # for a match as well, this can be # anything you want it to be ... target => My::App->get_controller('blog')->get_action('index') )); $router->add_route('blog/:year/:month/:day' => ( defaults => { controller => 'blog', action => 'show_date', }, # validate with ... validations => { # ... raw-Regexp refs year => qr/d{4}/, # ... custom Moose types you created month => 'NumericMonth', # ... Moose anon-subtypes created inline day => subtype('Int' => where { $_ add_route('blog/:action/?:id' => ( defaults => { controller => 'blog', }, validations => { action => qr/D+/, id => 'Int', # also use plain Moose types too } )); # ... in your dispatcher # returns a Path::Router::Route::Match object my $match = $router->match('/blog/edit/15'); # ... in your code my $uri = $router->uri_for( controller => 'blog', action => 'show_date', year => 2006, month => 10, day => 5, );This module provides a way of deconstructing paths into parameters suitable for dispatching on. It also provides the inverse in that it will take a list of parameters, and construct an appropriate uri for it.t. Requirements: · Perl


Path::Router Related Software