diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-09-14 23:43:25 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-09-14 23:43:25 +0000 |
commit | 816611491e0184792a6d481faed41557bfefb707 (patch) | |
tree | 1e8972ad55f45ddd2e3e48c5c3ac628ccb5a2db9 /perl-install/common.pm | |
parent | 0b53ba66063c183f5bd5587c89c125024002c62b (diff) | |
download | drakx-816611491e0184792a6d481faed41557bfefb707.tar drakx-816611491e0184792a6d481faed41557bfefb707.tar.gz drakx-816611491e0184792a6d481faed41557bfefb707.tar.bz2 drakx-816611491e0184792a6d481faed41557bfefb707.tar.xz drakx-816611491e0184792a6d481faed41557bfefb707.zip |
no_comment
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r-- | perl-install/common.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index d30906a21..baef6befa 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( - common => [ qw(__ min max sum sign product bool bool2text to_int ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ], + common => [ qw(__ min max sum sign product bool listlength bool2text to_int ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ], functional => [ qw(fold_left map_index map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh setVarsInSh) ], @@ -53,6 +53,7 @@ sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } sub dirname { @_ == 1 or die "usage: dirname <name>\n"; local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' } sub basename { @_ == 1 or die "usage: basename <name>\n"; local $_ = shift; s|/*\s*$||; s|.*/||; $_ } sub bool { $_[0] ? 1 : 0 } +sub listlength { scalar @_ } sub bool2text { $_[0] ? "true" : "false" } sub strcpy { substr($_[0], $_[2] || 0, length $_[1]) = $_[1] } sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } |