The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sloth::Representation - An object capable of creating a representation of a resource

METHODS

content_type

    $self->content_type

Required. Classes which consume this role must implement this method.

Returns either a string of the content-type that this representation represents (ie, 'application/xml'), or a regular expression to match against a content type (ie, qr{.+/.+}).

serialize

    $self->serialize($resource);

Required. Classes which consume this role must implement this method.

Takes a resource, returned by processing a Sloth::Method, and creates a representation of the resource. For example, a JSON representation might just return the result of "encode_json" in JSON::Any.

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.