diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-28 12:05:11 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-28 12:05:11 +0000 |
commit | c510ef70c40545fc14209b2afc414ef137264105 (patch) | |
tree | 06e9059c7c19fa746367733917a1e214718847f5 /urpm/util.pm | |
parent | f076742409681509eee3d28369b21f495ed19d42 (diff) | |
download | urpmi-c510ef70c40545fc14209b2afc414ef137264105.tar urpmi-c510ef70c40545fc14209b2afc414ef137264105.tar.gz urpmi-c510ef70c40545fc14209b2afc414ef137264105.tar.bz2 urpmi-c510ef70c40545fc14209b2afc414ef137264105.tar.xz urpmi-c510ef70c40545fc14209b2afc414ef137264105.zip |
move uniq to urpm::util (i need it in urpm::media)
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 77ee415c..520ce7f7 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -11,7 +11,7 @@ our @EXPORT = qw(quotespace unquotespace untaint copy_and_own same_size_and_mtime - partition + partition uniq difference2 member file_size cat_ dirname basename ); @@ -125,6 +125,7 @@ sub partition(&@) { \@a, \@b; } +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 } sub cat_ { my @l = map { my $F; open($F, '<', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l } |