From d51047ddd4c0c7471fe13ecbced75bf8f1e3acd6 Mon Sep 17 00:00:00 2001 From: Ken-ichi Mito Date: Wed, 21 Aug 2013 09:37:11 +0900 Subject: [PATCH] utils::get returns '[]' while json_api gives no results * GitHubBackup->repos gives '[]' if no repositories --- Dev/github/GitHubBackup.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dev/github/GitHubBackup.pm b/Dev/github/GitHubBackup.pm index d9d35a3..a821840 100644 --- a/Dev/github/GitHubBackup.pm +++ b/Dev/github/GitHubBackup.pm @@ -32,7 +32,7 @@ sub get { } my $page = 1; - my $data; + my $data = []; while(1) { my $result = json_api("$url?per_page=100&page=$page$parameters"); if (ref($result) eq 'ARRAY' && scalar @$result > 0) { @@ -103,6 +103,8 @@ sub repos { my $self = shift; return $self->{repos} if ($self->{repos}); + $self->{repos} = []; + my $account = $self->account or croak "account is not set"; if (my $repository = $self->repository) { $self->{repos} = [ -- 1.7.9.5