Amon2::Web::Dispatcher::RouterSimple::Extended - extending Amon2::Web::Dispatcher::RouterSimple
package MyApp::Web::Dispatcher; use strict; use warnings; use utf8; use Amon2::Web::Dispatcher::RouterSimple::Extended; connect '/' => 'Root#index'; # API submapper '/api/' => API => sub { get 'foo' => 'foo'; post 'bar' => 'bar'; }; # user submapper '/user/' => User => sub { get '', 'index'; connect '{uid}', 'show'; post '{uid}/hoge', 'hoge'; connect 'new', 'create'; }; 1;
This is an extension of Amon2::Web::Dispatcher::RouterSimple. 100% compatible, and it provides useful functions.
this is equivalent to:
connect $path, { controller => $controller, action => $action }, { method => 'GET' };
connect $path, { controller => $controller, action => $action }, { method => 'POST' };
connect $path, { controller => $controller, action => $action }, { method => 'PUT' };
connect $path, { controller => $controller, action => $action }, { method => 'DELETE' };
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 behave in the same way as Amon2::Web::Dispatcher::RouterSimple.
Copyright (C) Taiyoh Tanaka
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Taiyoh Tanaka <sun.basix@gmail.com>
Amon2::Web::Dispatcher::RouterSimple
To install Amon2::Web::Dispatcher::RouterSimple::Extended, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Amon2::Web::Dispatcher::RouterSimple::Extended
CPAN shell
perl -MCPAN -e shell install Amon2::Web::Dispatcher::RouterSimple::Extended
For more information on module installation, please visit the detailed CPAN module installation guide.