| 1 | package Net::OpenSocial::Client::Formatter; | ||
| 2 | |||
| 3 | 1 | ▶ | use Any::Moose '::Role'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | has 'content_type' => ( | |
| 6 | is => 'ro', | ||
| 7 | isa => 'Str', | ||
| 8 | ); | ||
| 9 | |||
| 10 | 1 | has 'name' => ( | |
| 11 | is => 'ro', | ||
| 12 | isa => 'Str', | ||
| 13 | ); | ||
| 14 | |||
| 15 | 1 | requires qw(encode decode); | |
| 16 | |||
| 17 | 1 | 1; | |
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Net::OpenSocial::Client::Formatter - Formatter role | ||
| 22 | |||
| 23 | =head1 SYNOPSIS | ||
| 24 | |||
| 25 | package MyFormatter; | ||
| 26 | use Any::Moose; | ||
| 27 | with 'Net::OpenSocial::Client::Formatter'; | ||
| 28 | |||
| 29 | has '+content_type' => (...); | ||
| 30 | has '+name' => (...); | ||
| 31 | |||
| 32 | sub encode { | ||
| 33 | ... | ||
| 34 | } | ||
| 35 | |||
| 36 | sub decode { | ||
| 37 | ... | ||
| 38 | } | ||
| 39 | |||
| 40 | =head1 DESCRIPTION | ||
| 41 | |||
| 42 | This module provides just a interface to encode/decode | ||
| 43 | resource object. | ||
| 44 | Implement each methods in concrete classes. | ||
| 45 | |||
| 46 | =head1 METHODS | ||
| 47 | |||
| 48 | =head2 content_type | ||
| 49 | |||
| 50 | Mime type for the format. | ||
| 51 | |||
| 52 | =head2 name | ||
| 53 | |||
| 54 | Formatter name | ||
| 55 | |||
| 56 | =head2 encode | ||
| 57 | |||
| 58 | Encode perl object to a formatted string. | ||
| 59 | |||
| 60 | =head2 decode | ||
| 61 | |||
| 62 | Decode formatted string to perl object. | ||
| 63 | |||
| 64 | =head1 AUTHOR | ||
| 65 | |||
| 66 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||
| 67 | |||
| 68 | =head1 COPYRIGHT AND LICENSE | ||
| 69 | |||
| 70 | Copyright (C) 2009 by Lyo Kato | ||
| 71 | |||
| 72 | This library is free software; you can redistribute it and/or modify | ||
| 73 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||
| 74 | at your option, any later version of Perl 5 you may have available. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||