diff options
Diffstat (limited to 'urpm/util.pm')
-rw-r--r-- | urpm/util.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/urpm/util.pm b/urpm/util.pm index 81534aa8..c6d51ea4 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -12,6 +12,7 @@ our @EXPORT = qw(min max quotespace unquotespace copy_and_own same_size_and_mtime partition put_in_hash uniq uniq_ + begins_with difference2 member file_size cat_ cat_utf8 output_safe dirname basename ); @@ -128,6 +129,11 @@ sub partition(&@) { \@a, \@b; } +sub begins_with { + my ($s, $prefix) = @_; + index($s, $prefix) == 0; +} + 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]} } |