Skip to content

Commit

Permalink
checks for empty answers made a bit more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
wchristian committed Dec 4, 2011
1 parent d2b9541 commit 9aa68f6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Net/LastFMAPI.pm
Expand Up @@ -318,10 +318,8 @@ sub extract_rows {
my @data_keys = sort keys %{$main_data}; my @data_keys = sort keys %{$main_data};
unless (@main_keys == 1 && @data_keys == 2 && $data_keys[0] eq '@attr') { unless (@main_keys == 1 && @data_keys == 2 && $data_keys[0] eq '@attr') {
carp "extracting rows may be broken"; carp "extracting rows may be broken";
if (defined $main_data->{'#text'} && $main_data->{'#text'} =~ /^\s+$/ my ( $text, $total ) = ( $main_data->{'#text'}, $main_data->{total} );
&& defined $main_data->{total} && $main_data->{total} == 0) { # no rows return if defined $text && $text =~ /^\s+$/ && defined $total && $total == 0; # no rows
return ();
};
} }
%last_response_meta = %{ $main_data->{$data_keys[0]} }; %last_response_meta = %{ $main_data->{$data_keys[0]} };
my $rows = $main_data->{$data_keys[1]}; my $rows = $main_data->{$data_keys[1]};
Expand Down

0 comments on commit 9aa68f6

Please sign in to comment.