From e86042cb712bb741d92770bdf4d131ea100a1bd4 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sat, 30 Jan 2010 15:20:49 +0100 Subject: don't fetch info if profile exists --- lib/githubexplorer/Profile.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/githubexplorer/Profile.pm') diff --git a/lib/githubexplorer/Profile.pm b/lib/githubexplorer/Profile.pm index 7966d79..1f38452 100644 --- a/lib/githubexplorer/Profile.pm +++ b/lib/githubexplorer/Profile.pm @@ -10,10 +10,12 @@ sub fetch_profile { my ( $self, $login, $depth ) = @_; return if grep {$_ =~ /$login/i} @{$self->banned_profiles}; - return if $depth > 2; + my $profile = $self->_profile_exists($login); + return $profile if $profile; + say "fetch profile for $login ($depth)..."; my $github = Net::GitHub::V2::Users->new( owner => $login, @@ -25,9 +27,9 @@ sub fetch_profile { if ( !$profile ) { $profile = $self->_create_profile( $login, $github->show, $depth ); sleep(1); - } - if ( $self->with_repo ) { - $self->fetch_repositories( $profile, $github->list ); + if ( $self->with_repo ) { + $self->fetch_repositories( $profile, $github->list ); + } } my $followers = $github->followers(); -- cgit 1.4.1