From cc3bd295302eb0cf9de43d8be05b29ce83fa584f Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 28 Dec 2014 18:10:29 +0000 Subject: slightly less awkward try/CATCH --- lib/Net/Hawk/Client.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/Net/Hawk/Client.pm b/lib/Net/Hawk/Client.pm index 2a9d4c9..ee80d57 100644 --- a/lib/Net/Hawk/Client.pm +++ b/lib/Net/Hawk/Client.pm @@ -97,13 +97,12 @@ package Net::Hawk::Client { my $www_auth = get_header('www-authenticate',$headers); if ($www_auth) { - my $attributes; - try { + my $attributes = try { $attributes = parse_authorization_header( $www_auth,, ); - CATCH { default { return False } } }; + return False unless $attributes; if ($attributes) { my $tsm = calculate_ts_mac( @@ -116,14 +115,13 @@ package Net::Hawk::Client { my $serv_auth = get_header('server-authorization',$headers); return True unless $serv_auth || $options; - my $attributes; - try { - $attributes = parse_authorization_header( + my $attributes = try { + parse_authorization_header( $serv_auth, , ); - CATCH { default { return False } } }; + return False unless $attributes; my $mac = calculate_mac( 'response', -- cgit v1.2.3