11 Mar 2011 11:34:57 UTC
- Distribution: Sloth
- Module version: 0.05
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (150 / 0 / 7)
- KwaliteeBus factor: 0
- % Coverage
- License: perl_5
- Activity24 month
- Download (18.81KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCYCLES Oliver Charlesand 1 contributors
- Oliver Charles
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- COPYRIGHT AND LICENSE
Sloth::Method - The implementation of a single HTTP method on a resource
This map defines a list of parsers that are able to parse the body of a HTTP request into a meaningful, but more importantly, common, set of input parameters.
If this is left undefined it is assumed that a body is not meant to be provided to the method, and that all necessary parameters can be derived from the URI query parameters and path parts.
A Data::TreeValidator validator.
This takes the input from query parameters, path parts, and possibly the parsed request body, and validates it. It can optionally transform the data, and will finally return a set of clean input parameters which are passed to "execute".
$self->process_request($request : Sloth::Request)
Process a Sloth::Request and possibly return a resource.
You usually won't need to override this method, as by default it does the boiler plate plumbing for you (checking the Accept header, trying to parse the body, etc). Most users will simply need to implement "execute".
Required. Classes which consume this role must implement this method.
Executes the implemented HTTP method (for example a GET or DELETE operation) and optionally returns a resource to represent back to the user. Takes an object that represents the cleaned input parameters - a combination of path arguments, query paramaters and the parsed body (if there was one).
If you are returning a custom Sloth::Response from your method body, you may still wish to serialize some data into the response body. By using
try_serializeyou will get correct handling of the
Accept:header from the client.
This software is copyright (c) 2011 by Oliver Charles <email@example.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.