summaryrefslogtreecommitdiffstats
path: root/perl-install/common.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r--perl-install/common.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 9a21b7b57..77567726a 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 ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate) ],
+ common => [ qw(__ min max sum sign product bool 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 difference2) ],
file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh) ],
@@ -129,6 +129,20 @@ sub untranslate($@) {
die "untranslate failed";
}
+sub warp_text($;$) {
+ my ($text, $width) = shift;
+ $width ||= 80;
+
+ my ($t, @l); foreach (split /(\s+)/, $text) {
+ if (length "$t$_" > $width) {
+ push @l, $t;
+ $t = '';
+ }
+ $t .= $_;
+ }
+ @l, $t;
+}
+
sub getVarsFromSh($) {
my %l;
local *F;