Amon2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    Date:   Mon May 18 22:06:28 2015 +0900

        add canonical parameter to plugin-web-json

6.11 2014-12-15T11:21:26Z

    commit 29179a2b7dd9c5fac6bc293d486256fd5ce39838
    Author: karupanerura <karupa@cpan.org>
    Date:   Mon Dec 15 17:00:02 2014 +0900

        Amon2::Web::Dispatcher::RouterBoom allows PUT method.

6.10 2014-10-06T05:14:23Z

    - Update static library deps
      (GeJ++)

6.09 2014-08-06T05:35:15Z

    - Do not allow invalid charracter in Plugin::Web::Streaming.

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

                $dest{class}      = $base ? "${base}::${controller}" : $controller;
                $dest{method}     = $method if defined $method;
            }

            my $http_method;
            if ($method eq 'get') {
                $http_method = ['GET','HEAD'];
            } elsif ($method eq 'post') {
                $http_method = 'POST';
            } elsif ($method eq 'put') {
                $http_method = 'PUT';
            } elsif ($method eq 'delete_') {
                $http_method = 'DELETE';
            }

            $router->add($http_method, $path, \%dest);
        };
    }

    # class methods
    *{"${caller}::router"} = sub { $router };

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

    put  '/:user/blog/put'  => 'Blog#put';
    delete_ '/:user/blog/:id' => 'Blog#remove';

Add routes by DSL. First argument is the path pattern in Path::Boom rules.
Second argument is the destination method path.

Destination method pass is C<${class}#${method}> form.

The path declared with get() accepts GET and HEAD.
The path declared with post() accepts POST method.
The path declared with put() accepts PUT method.
The path declared with delete_() accepts DELETE method.
The path declared with any() accepts any methods.

=item C<< base($klass:Str) >>

    base 'My::App::Web::C';

You can specify the base class name for 'Root#index' style definition.

If you are write your dispatcher in following code, then the method for '/' is C<< My::App::Web::C::Root->index >>.



( run in 3.453 seconds using v1.01-cache-2.11-cpan-f56aa216473 )