The client performs a HTTP method on a resource uri.
Apache2::REST splits the uri in fragments.
Apache2::REST builds a Apache2::REST::Handler and let it handle the root fragment
Apache2::REST then writes the response back to the client with the appropriate writer.
If the response is written as a string (which is true for defaults writers), this string is a unicode string encoded in UTF-8 bytes.
If the requested resource is terminal, it performs the requested HTTP method (if allowed).
If the requested resource is not terminal, it solves the next fragment buy building the next handler. By default, the next handler is a class one level down in the package hierachy.
Client request: GET /foo/bar
URI fragments are (foo bar)
(foo bar)
A root handler is built according to Apache2RESTHandlerRootClass - See Apache2::REST. Let's assume this root handler is MyApp::REST::API. See Apache2::REST::Handler.
MyApp::REST::API
This root handle is not terminal for this request, so it builds the next handler.
The next handler will be a MyApp::REST::API::foo
One more step and the terminal handler is a MyApp::REST::API::foo::bar
The method GET is called on the MyApp::REST::API::foo::bar instance.
The Apache2::REST::Response is written back to the client by Apache2::REST::Handler
To install Apache2::REST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::REST
CPAN shell
perl -MCPAN -e shell install Apache2::REST
For more information on module installation, please visit the detailed CPAN module installation guide.