diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-07-16 16:12:32 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-07-16 16:12:32 +0200 |
| commit | 5fdee9e79b5b6a72522bee59e4bd7c62506a43c7 (patch) | |
| tree | 9e9f16e674310d95f7c39cea92e87aaa57d67746 /lib/MooseX/Net/API/Role/Format.pm | |
| parent | another fix for path (diff) | |
| download | moosex-net-api-5fdee9e79b5b6a72522bee59e4bd7c62506a43c7.tar.gz | |
remove tests and old lib; use base net::http::api; DEPRECATED
Diffstat (limited to 'lib/MooseX/Net/API/Role/Format.pm')
| -rw-r--r-- | lib/MooseX/Net/API/Role/Format.pm | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/lib/MooseX/Net/API/Role/Format.pm b/lib/MooseX/Net/API/Role/Format.pm deleted file mode 100644 index 5c37a47..0000000 --- a/lib/MooseX/Net/API/Role/Format.pm +++ /dev/null @@ -1,65 +0,0 @@ -package MooseX::Net::API::Role::Format; - -# ABSTRACT: Set appropriate format to request header - -use Moose::Role; -use Moose::Util::TypeConstraints; - -sub content_type { - { json => {value => 'application/json', module => 'JSON',}, - yaml => {value => 'text/x-yaml', module => 'YAML'}, - xml => {value => 'text/xml', module => 'XML::Simple'}, - }; -} - -subtype Format => as 'Str' => where { - my $format = shift; - grep {/^$format$/} keys %{content_type()}; -}; - -enum 'FormatMode' => qw(content-type append); - -has api_format => ( - is => 'rw', - isa => 'Format', - lazy => 1, - default => sub { - my $self = shift; - $self->meta->get_api_option('api_format'); - } -); - -has api_format_mode => ( - is => 'rw', - isa => 'FormatMode', - lazy => 1, - default => sub { - my $self = shift; - my $mode = $self->meta->get_api_option('api_format_mode') || 'append'; - $mode; - } -); - -1; - -=head1 SYNOPSIS - -=head1 DESCRIPTION - -=head2 METHODS - -=over 4 - -=item B<content_type> - -=back - -=head2 ATTRIBUTES - -=over 4 - -=item B<api_format> - -=item B<api_format_mode> - -=back |
