Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ensure that rows are extracted from cache contents as well, when want…

…array is in effect
  • Loading branch information...
commit 3311fcdd31f57dec91740f2a0db1403925ce002f 1 parent 93e2761
Christian Walde wchristian authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 lib/Net/LastFMAPI.pm
15 lib/Net/LastFMAPI.pm
View
@@ -211,7 +211,7 @@ sub lastfm {
my $file = "$cache/".md5_hex(encode_json(\@_));
if (-f $file) {
my $data = loadfile($file);
- return $data->{content}
+ return _rowify_content( $data->{content} );
}
else {
$cache = $file
@@ -288,12 +288,13 @@ sub lastfm {
dumpfile($cache, {content => $content});
}
$last_response = $content;
- if (wantarray) {
- return extract_rows($content);
- }
- else {
- return $content;
- }
+ return _rowify_content( $content );
+}
+
+sub _rowify_content {
+ my ( $content ) = @_;
+ return extract_rows( $content ) if wantarray;
+ return $content;
}
sub extract_rows {
Please sign in to comment.
Something went wrong with that request. Please try again.