Amon2-Web-Dispatcher-RouterSimple-Extended

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

- get $path, "${controller}\#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'GET' };'

- post $path, "${controller}\#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'POST' };'

- put $path, "${controller}\#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'PUT' };'

- delete $path, "${controller}\#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'DELETE' };'

- submapper $path, $controller, sub {}

this is main feature of this module. In subroutine of the third argument, connect/get/post/put/delete method fits in submapper. As a results, in submapper you can be described in the same interface. If this third argument not exists, this function be...


lib/Amon2/Web/Dispatcher/RouterSimple/Extended.pm  view on Meta::CPAN

package Amon2::Web::Dispatcher::RouterSimple::Extended;
use strict;
use warnings;

our $VERSION = "0.05.01";

use Router::Simple 0.03;

my @METHODS = qw/GET POST PUT DELETE/;
my $submap;

sub import {
    my $class = shift;
    my %args = @_;
    my $caller = caller(0);

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

    no strict 'refs';

lib/Amon2/Web/Dispatcher/RouterSimple/Extended.pm  view on Meta::CPAN


this is equivalent to:

    connect $path, { controller => $controller, action => $action }, { method => 'POST' };


=item put $path, "${controller}#${action}"

this is equivalent to:

    connect $path, { controller => $controller, action => $action }, { method => 'PUT' };


=item delete $path, "${controller}#${action}"

this is equivalent to:

    connect $path, { controller => $controller, action => $action }, { method => 'DELETE' };


=item submapper $path, $controller, sub {}



( run in 0.381 second using v1.01-cache-2.11-cpan-4e96b696675 )