diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-17 11:57:37 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-17 11:57:37 +0000 |
commit | 2864278acd38b3b4bd5410c2022d21bf3154e933 (patch) | |
tree | 4ad7fed58db7e7d5f2a6e592e4baf4f9436c82ef /urpm/util.pm | |
parent | af7637f44d8b40f1945607f12f1b066a54dc6a8b (diff) | |
download | urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.gz urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.bz2 urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.xz urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.zip |
- urpmq:
o add --provides
Diffstat (limited to 'urpm/util.pm')
-rw-r--r-- | urpm/util.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/urpm/util.pm b/urpm/util.pm index 19209a3a..81534aa8 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 put_in_hash uniq + partition put_in_hash uniq uniq_ difference2 member file_size cat_ cat_utf8 output_safe dirname basename ); @@ -135,6 +135,13 @@ sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } sub cat_ { my @l = map { my $F; open($F, '<', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l } sub cat_utf8 { my @l = map { my $F; open($F, '<:utf8', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l } +sub uniq_(&@) { + my $f = shift; + my %l; + $l{$f->($_)} = 1 foreach @_; + grep { delete $l{$f->($_)} } @_; +} + sub output_safe { my ($file, $content) = @_; |