summaryrefslogtreecommitdiffstats
path: root/urpm/util.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-01-18 16:42:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-01-18 16:42:17 +0000
commit1c459d805a75d0c1931d651c04df3ed01489d1c7 (patch)
tree7a07b921994029f9fbfdcaee2e0cedc813d24c9e /urpm/util.pm
parent3ab51fa0b278a0a28e9f1e0a7d3dff43d22e0d48 (diff)
downloadurpmi-1c459d805a75d0c1931d651c04df3ed01489d1c7.tar
urpmi-1c459d805a75d0c1931d651c04df3ed01489d1c7.tar.gz
urpmi-1c459d805a75d0c1931d651c04df3ed01489d1c7.tar.bz2
urpmi-1c459d805a75d0c1931d651c04df3ed01489d1c7.tar.xz
urpmi-1c459d805a75d0c1931d651c04df3ed01489d1c7.zip
add begins_with()
Diffstat (limited to 'urpm/util.pm')
-rw-r--r--urpm/util.pm6
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]} }