GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTTP::Router(3) User Contributed Perl Documentation HTTP::Router(3)

HTTP::Router - Yet Another Path Router for HTTP

  use HTTP::Router;

  my $router = HTTP::Router->new;

  my $route = HTTP::Router::Route->new(
      path       => '/',
      conditions => { method => 'GET' },
      params     => { controller => 'Root', action => 'index' },
  );
  $router->add_route($route);
  # or
  $router->add_route('/' => (
      conditions => { method => 'GET' },
      params     => { controller => 'Root', action => 'index' },
  ));

  # GET /
  my $match = $router->match($req);
  $match->params;  # { controller => 'Root', action => 'index' }
  $match->uri_for; # '/'

HTTP::Router provides a way of constructing routing tables.

If you are interested in a Merb-like constructing way, please check HTTP::Router::Declare.

Returns a HTTP::Router object.

Adds a new route. You can specify HTTP::Router::Route object, or path string and options pair.

example:

  my $route = HTTP::Router::Route->new(
      path       => '/',
      conditions => { method => 'GET' },
      params     => { controller => 'Root', action => 'index' },
  );

  $router->add_route($route);

equals to:

  $router->add_route('/' => (
      conditions => { method => 'GET' },
      params     => { controller => 'Root', action => 'index' },
  ));

Returns registered routes.

Clears registered routes.

Creates inline matcher using registered routes.

Clears inline matcher.

Returns true if inline matcher is defined.

Returns a HTTP::Router::Match object that matches a given request. If no routes match, it returns "undef".

Returns a HTTP::Router::Route object that matches a given request. If no routes match, it returns "undef".

NAKAGAWA Masaki <masaki@cpan.org>

Takatoshi Kitano <kitano.tk@gmail.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

HTTP::Router::Declare, HTTP::Router::Route, HTTP::Router::Match,

MojoX::Routes, <http://merbivore.com/>, HTTPx::Dispatcher, Path::Router, Path::Dispatcher

2010-03-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.