Jedi::Role::App - Jedi App Role
version 0.13
This role is to apply to your Moo module.
use Moo; with 'Jedi::Role::App';
You should use the Jedi::App module.
You module need to defined the sub "jedi_app", the road will call it directly.
Define a GET method.
$jedi->get("/", sub{...});
Define a POST method.
$jedi->post("/", sub{...});
Define a PUT method.
$jedi->put("/", sub{...});
Define a DEL method.
$jedi->del("/", sub{...});
If no route matches, all the missing method is executed.
$jedi->missing(sub{...});
This will solve the route, and run all the method found.
If none is found, we run all the missing methods.
The route continue until a "false" response it sent. That should always mean an error.
$jedi->response($request, $response);
All the methods, take a route, and a sub.
The route can be a scalar (exact match) or a regexp.
The sub take Jedi::App, a Jedi::Request and a Jedi::Response.
Each sub should fill the Response based on the Request.
The return code should be "1" if everything goes fine, to let other matching route to apply their changes.
If the return is "0" or undef (false), the route stop and return the response.
You should only use the bad return if something goes wrong.
You can have multiple time the same route catch (thought regexp, and exact match). Each one receive a response, and pass this response to the next sub.
Please report any bugs or feature requests on the bugtracker website https://tasks.celogeek.com/projects/perl-modules-jedi
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
celogeek <me@celogeek.com>
This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Jedi, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jedi
CPAN shell
perl -MCPAN -e shell install Jedi
For more information on module installation, please visit the detailed CPAN module installation guide.