Skip to content

Commit

Permalink
removed Try::Tiny dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Dec 17, 2016
1 parent 1a0baf4 commit 49e1b55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion cpanfile
Expand Up @@ -9,7 +9,6 @@ requires "Net::SSLeay" => "1.49";
requires "Ref::Util" => "0";
requires "Safe::Isa" => "0";
requires "Search::Elasticsearch" => "== 2.03"; # pinned
requires "Try::Tiny" => "0";
requires "perl" => "5.010";
requires "strict" => "0";
requires "warnings" => "0";
Expand Down
9 changes: 6 additions & 3 deletions lib/MetaCPAN/Client/Request.pm
Expand Up @@ -7,7 +7,6 @@ use Moo;
use Carp;
use JSON::MaybeXS qw<decode_json encode_json>;
use Search::Elasticsearch;
use Try::Tiny;
use HTTP::Tiny;
use Ref::Util qw< is_arrayref is_hashref >;

Expand Down Expand Up @@ -172,8 +171,12 @@ sub _decode_result {
$url =~ m|/source/| and return $content;

my $decoded_result;
try { $decoded_result = decode_json $content }
catch { croak "Couldn't decode '$content': $_" };
eval {
$decoded_result = decode_json $content;
1;
} or do {
croak "Couldn't decode '$content': $@";
};

return $decoded_result;
}
Expand Down

0 comments on commit 49e1b55

Please sign in to comment.