cpan2ips.pl: Filter unique deps
authorIgor Pashev <igor.pashev@nexenta.com>
Fri, 14 Oct 2011 17:42:40 +0400
changeset 448 11a4d6c5b270
parent 447 f1790f276df9
child 449 2a36deca4819
cpan2ips.pl: Filter unique deps
tools/cpan2ips.pl
--- a/tools/cpan2ips.pl	Fri Oct 14 17:17:46 2011 +0400
+++ b/tools/cpan2ips.pl	Fri Oct 14 17:42:40 2011 +0400
@@ -38,6 +38,11 @@
             or fatal "Can't create dir `$path': $!";
     }
 }
+sub uniq {
+    my ($array_ref) = @_;
+    my %hash = map { $_, 1 } @$array_ref;
+    @$array_ref = keys %hash;
+}
 
 sub shell_exec {
     my ($cmd) = @_;
@@ -178,6 +183,7 @@
         my $dep_pkg_name = do_package($_);
         push @pkg_deps, $dep_pkg_name if $dep_pkg_name;
     }
+    uniq \@pkg_deps;
     blab "Required for `$pkg_name' packages: ", (join ', ', @pkg_deps);