From 0835933ed1a4a09a925cb549927b26d774e70fa4 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Thu, 17 Jun 2010 14:20:38 +0200 Subject: fix format --- lib/MooseX/Net/API/Meta/Method/APIDeclare.pm | 3 ++- lib/MooseX/Net/API/Role/Format.pm | 4 ++-- lib/MooseX/Net/API/Role/Serialization.pm | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/MooseX/Net/API') diff --git a/lib/MooseX/Net/API/Meta/Method/APIDeclare.pm b/lib/MooseX/Net/API/Meta/Method/APIDeclare.pm index f9274bf..0de38df 100644 --- a/lib/MooseX/Net/API/Meta/Method/APIDeclare.pm +++ b/lib/MooseX/Net/API/Meta/Method/APIDeclare.pm @@ -8,6 +8,7 @@ use MooseX::Net::API::Error; my @accepted_options = qw/ api_base_url api_format + api_format_mode api_username api_password authentication @@ -37,7 +38,7 @@ sub add_net_api_declare { } # XXX for backward compatibility - for my $attr (qw/base_url format username password/) { + for my $attr (qw/base_url format format_mode username password/) { my $attr_name = "api_" . $attr; if (exists $options{$attr} && !exists $options{$attr_name}) { $options{$attr_name} = delete $options{$attr}; diff --git a/lib/MooseX/Net/API/Role/Format.pm b/lib/MooseX/Net/API/Role/Format.pm index abffbe6..5c37a47 100644 --- a/lib/MooseX/Net/API/Role/Format.pm +++ b/lib/MooseX/Net/API/Role/Format.pm @@ -35,8 +35,8 @@ has api_format_mode => ( lazy => 1, default => sub { my $self = shift; - my $mode = $self->meta->get_api_option('api_format_mode'); - $mode || 'append'; + my $mode = $self->meta->get_api_option('api_format_mode') || 'append'; + $mode; } ); diff --git a/lib/MooseX/Net/API/Role/Serialization.pm b/lib/MooseX/Net/API/Role/Serialization.pm index 1a090d1..fe86b9f 100644 --- a/lib/MooseX/Net/API/Role/Serialization.pm +++ b/lib/MooseX/Net/API/Role/Serialization.pm @@ -55,7 +55,8 @@ sub deserialize { sub serialize { my ($self, $content) = @_; - my $s = $self->_get_serializer($self->api_format); + my $s = $self->_get_serializer($self->api_format) + || $self->_load_serializer(); my $result = try { $s->encode($content) }; return $result if $result; } @@ -96,3 +97,5 @@ sub _load_serializer { =item B =back +99: hit eof while in pod documentation (no =cut seen) + this can cause trouble with some pod utilities -- cgit 1.4.1