summaryrefslogtreecommitdiffstats
path: root/perl-install/common.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-07-24 10:23:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-07-24 10:23:21 +0000
commit7e5672eb837597a08dc886dc022f704be9b97665 (patch)
tree51aba798e9eb6501aa32cc1cfdbf4d759a031b3b /perl-install/common.pm
parent5d8a5663900537c6695f08692920d666f5ec9213 (diff)
downloaddrakx-7e5672eb837597a08dc886dc022f704be9b97665.tar
drakx-7e5672eb837597a08dc886dc022f704be9b97665.tar.gz
drakx-7e5672eb837597a08dc886dc022f704be9b97665.tar.bz2
drakx-7e5672eb837597a08dc886dc022f704be9b97665.tar.xz
drakx-7e5672eb837597a08dc886dc022f704be9b97665.zip
generalize the use of chomp_ as the functional alternative to chomp (and works on lists)
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r--perl-install/common.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 0eed816b1..e9e2bb93d 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -6,9 +6,9 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- common => [ qw(__ may_apply even odd arch better_arch compat_arch min max sqr sum and_ or_ if_ if__ sign product bool invbool listlength bool2text bool2yesno text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ put_in_hash set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines deref next_val_in_array) ],
+ common => [ qw(__ may_apply even odd arch better_arch compat_arch min max sqr sum and_ or_ if_ if__ chomp_ sign product bool invbool listlength bool2text bool2yesno text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ put_in_hash set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines deref next_val_in_array) ],
functional => [ qw(fold_left compose mapgrep map_index grep_index find_index map_each grep_each list2kv map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie combine) ],
- file => [ qw(dirname basename touch all glob_ cat_ cat__ catMaybeCompressed output symlinkf renamef chop_ mode typeFromMagic expand_symlinks) ],
+ file => [ qw(dirname basename touch all glob_ cat_ cat__ catMaybeCompressed output symlinkf renamef mode typeFromMagic expand_symlinks) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ salt getVarsFromSh setVarsInSh setVarsInShMode setVarsInCsh substInFile availableMemory availableRamMB removeXiBSuffix formatXiB template2file template2userfile update_userkderc list_skels formatTime formatTimeRaw unix2dos setVirtual isCdNotEjectable) ],
constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE %compat_arch) ],
);
@@ -94,7 +94,7 @@ sub deref { ref $_[0] eq "ARRAY" ? @{$_[0]} : ref $_[0] eq "HASH" ? %{$_[0]} : $
sub linkf { unlink $_[1]; link $_[0], $_[1] }
sub symlinkf { unlink $_[1]; symlink $_[0], $_[1] }
sub renamef { unlink $_[1]; rename $_[0], $_[1] }
-sub chop_ { map { my $l = $_; chomp $l; $l } @_ }
+sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] }
sub divide { my $d = int $_[0] / $_[1]; wantarray ? ($d, $_[0] % $_[1]) : $d }
sub round { int ($_[0] + 0.5) }
sub round_up { my ($i, $r) = @_; $i = int $i; $i += $r - ($i + $r - 1) % $r - 1; }