diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-10 17:13:06 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-10 17:13:06 +0000 |
commit | 934a1d92fd571df712dddcad583bc4ca065cfd6a (patch) | |
tree | 4c9ed394d485cd7ce4ab94891e41b3fa0ccc7faf /urpm/util.pm | |
parent | d76a58b1c5dcf520cf27d481d6bd86ec62d70705 (diff) | |
download | urpmi-934a1d92fd571df712dddcad583bc4ca065cfd6a.tar urpmi-934a1d92fd571df712dddcad583bc4ca065cfd6a.tar.gz urpmi-934a1d92fd571df712dddcad583bc4ca065cfd6a.tar.bz2 urpmi-934a1d92fd571df712dddcad583bc4ca065cfd6a.tar.xz urpmi-934a1d92fd571df712dddcad583bc4ca065cfd6a.zip |
add put_in_hash() for future use
Diffstat (limited to 'urpm/util.pm')
-rw-r--r-- | urpm/util.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/urpm/util.pm b/urpm/util.pm index cb5dbff4..19209a3a 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -11,7 +11,7 @@ our @EXPORT = qw(min max quotespace unquotespace untaint copy_and_own same_size_and_mtime - partition uniq + partition put_in_hash uniq difference2 member file_size cat_ cat_utf8 output_safe dirname basename ); @@ -128,6 +128,7 @@ sub partition(&@) { \@a, \@b; } +sub put_in_hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} = $v } $a } sub uniq { my %l; $l{$_} = 1 foreach @_; grep { delete $l{$_} } @_ } sub difference2 { my %l; @l{@{$_[1]}} = (); grep { !exists $l{$_} } @{$_[0]} } sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } |