Mojolicious::Plugin::MoreHelpers - More helpers lacking in Mojolicious
# Mojolicious $app->plugin('MoreHelpers'); # Mojolicious::Lite plugin 'MoreHelpers';
Mojolicious::Plugin::MoreHelpers is a mingle of helpers lacking in Mojolicious Web framework for REST-like APIs.
Mojolicious::Plugin::MoreHelpers implements the following helpers.
my $params = $c->route_params(@names);
Recursive collect current route params and his parents.
my $v = $c->validation_json;
Merge flat request JSON object with validation.
my $h = $c->headers_response(%headers);
Set multiple reponse headers in one time.
$c->reply_json->success($data, %headers);
Render the success JSON object with status code, depend on POST or GET request.
$c->reply_json->bad_request(%headers);
Render empty JSON object with 400 Bad Request HTTP status.
$c->reply_json->unauthorized(%headers);
Render empty JSON object with 401 HTTP status.
$c->reply_json->forbidden(%headers);
Render empty JSON object with 403 Forbidden HTTP status.
$c->reply_json->not_found(%headers);
Render empty JSON object with 404 Not Found HTTP status.
$c->reply-_json>not_acceptable(%headers);
Render empty JSON object with 406 HTTP status.
$c->reply_json->unprocessable(%headers);
Render empty JSON object with 422 HTTP status.
$c->reply_json->locked(%headers);
Render empty JSON object with 423 HTTP status.
$c->reply_json->rate_limit(%headers);
Render empty JSON object with 429 HTTP status.
$c->reply_json->unavailable(%headers);
Render empty JSON object with 503 HTTP status.
$c->reply_json->dispatch($status, %headers);
Dispatch with status and render properly error code.
Validation checks.
String value is a internet IPv4 or IPv6 address.
String value is a valie Email address.
Mojolicious::Plugin::MoreHelpers inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register(Mojolicious->new);
Register helpers in Mojolicious application.
Mojolicious.
Bugs should always be submitted via the GitHub bug tracker.
https://github.com/bitnoize/mojolicious-plugin-morehelpers/issues
Feel free to fork the repository and submit pull requests.
https://github.com/bitnoize/mojolicious-plugin-morehelpers
Dmitry Krutikov <monstar@cpan.org>
Copyright 2020 Dmitry Krutikov.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojolicious::Plugin::MoreHelpers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::MoreHelpers
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::MoreHelpers
For more information on module installation, please visit the detailed CPAN module installation guide.