NAME
Sloth::Resource - A resource that exposed by the REST server
ATTRIBUTES
representations
A Map[Str =
Sloth::Representation]> of all known representations of resources.
By default, this will be taken from Sloth, your main Sloth application. However, if this resource only has specific representations that differ from the rest of you application, you can override it.
methods
A Map[MethodName =
Sloth::Method>.
A map of allowed HTTP methods on this resource, to their Sloth::Method implementation. By default you do not need to worry about specifying this attribute as Sloth will default to looking for methods below the current resource namespace (for example, Resource::Pancake
would look for Resource::Pancake::GET
and so on).
METHODS
resource_arguments
$self->resource_arguments : @List
Generate a set of parameters that will be passed to methods. If your methods all require a set of common, shared objects, you can override this to provide those extra initialization arguments.
handle_request
$self->handle_request($request : Sloth::Request)
Handle a request for a resource.
You will not normally need to change this method, as by default it will check if the method is allowed, if there is an available serializer, and handle all the dispatching for you.
AUTHOR
Oliver Charles
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Oliver Charles <sloth.cpan@ocharles.org.uk>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.