Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
check response
Browse files Browse the repository at this point in the history
  • Loading branch information
pmb0 committed Dec 2, 2014
1 parent df79a81 commit ec3cd4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Heise/Shariff/Service/Facebook.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package Heise::Shariff::Service::Facebook;

use Mojo::Base 'Heise::Shariff::Service';
use Mojo::Util qw(dumper);

sub request {
my ($self, $url) = @_;
Expand All @@ -15,7 +16,13 @@ sub request {

sub extract_count {
my ($self, $res) = @_;
return $res->json->[0]->{share_count};

if (ref $res->json eq 'ARRAY') {
return $res->json->[0]->{share_count};
} else {
warn dumper($res);
return 0;
}
}

sub get_name {
Expand Down

0 comments on commit ec3cd4e

Please sign in to comment.