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