X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/4d25de5c4ddfe4ad14823b550a0903e594207774..a48f904fea457d33eb8f7297469945fe3c05e4c1:/webcheckout?ds=inline diff --git a/webcheckout b/webcheckout index 19d4620..1238172 100755 --- a/webcheckout +++ b/webcheckout @@ -2,7 +2,7 @@ =head1 NAME -debcheckout - check out repositories referenced on a web page +webcheckout - check out repositories referenced on a web page =head1 SYNOPSIS @@ -152,21 +152,26 @@ sub better { sub dedup { my %seenhref; my %bytitle; + my @others; foreach my $repo (@_) { if (exists $repo->{title} && - length $repo->{title} && - exists $bytitle{$repo->{title}}) { - my $other=$bytitle{$repo->{title}}; - next unless better($repo, $other); - delete $bytitle{$other->{title}} + length $repo->{title}) { + if (exists $bytitle{$repo->{title}}) { + my $other=$bytitle{$repo->{title}}; + next unless better($repo, $other); + delete $bytitle{$other->{title}} + } + + if (! $seenhref{$repo->{href}}++) { + $bytitle{$repo->{title}}=$repo; + } } - - if (! $seenhref{$repo->{href}}++) { - $bytitle{$repo->{title}}=$repo; + else { + push @others, $repo; } } - return values %bytitle; + return values %bytitle, @others; } sub parse { @@ -190,7 +195,6 @@ sub parse { } getopts(); -print "$url\n"; my $page=get($url); if (! defined $page) {