diff options
author | franck cuny <franck@lumberjaph.net> | 2010-06-29 11:33:54 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-06-29 11:33:54 +0200 |
commit | 0909dd01e6369a63f84520bad36b4eb4ff19a448 (patch) | |
tree | 7ed7b99d4a3983e741f3aa134bc194e217be3ee1 | |
parent | another fix for path (diff) | |
download | moosex-net-api-0909dd01e6369a63f84520bad36b4eb4ff19a448.tar.gz |
check if auth_method is declared
-rw-r--r-- | lib/MooseX/Net/API/Role/Authentication.pm | 14 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/Serialization.pm | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/MooseX/Net/API/Role/Authentication.pm b/lib/MooseX/Net/API/Role/Authentication.pm index 7859154..06b7e69 100644 --- a/lib/MooseX/Net/API/Role/Authentication.pm +++ b/lib/MooseX/Net/API/Role/Authentication.pm @@ -5,14 +5,14 @@ package MooseX::Net::API::Role::Authentication; use Moose::Role; has api_username => ( - is => 'rw', - isa => 'Str', + is => 'rw', + isa => 'Str', predicate => 'has_api_username', ); has api_password => ( - is => 'rw', - isa => 'Str', + is => 'rw', + isa => 'Str', predicate => 'has_api_password', ); @@ -26,7 +26,9 @@ after BUILDALL => sub { $self->$_($value) if $value && !$self->$predicate; } - if (my $has_auth = $self->meta->get_api_option('authentication')) { + if ( $self->meta->get_api_option('authentication') + || $self->meta->get_api_option('authentication_method')) + { my $auth_method = $self->meta->get_api_option('authentication_method'); if ($auth_method) { $self->api_useragent->add_handler( @@ -61,3 +63,5 @@ after BUILDALL => sub { =item B<api_username> =back +64: hit eof while in pod documentation (no =cut seen) + this can cause trouble with some pod utilities diff --git a/lib/MooseX/Net/API/Role/Serialization.pm b/lib/MooseX/Net/API/Role/Serialization.pm index f10a101..92c0248 100644 --- a/lib/MooseX/Net/API/Role/Serialization.pm +++ b/lib/MooseX/Net/API/Role/Serialization.pm @@ -50,7 +50,8 @@ sub deserialize { my $s = $self->_get_serializer($format) || $self->_load_serializer($format); next unless $s; - my $result = try { $s->decode($content) }; + my $result; + try { $result = $s->decode($content) }; return $result if $result; } } |