summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/MooseX/Net/API/Role/Authentication.pm14
-rw-r--r--lib/MooseX/Net/API/Role/Serialization.pm3
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;
     }
 }