diff options
-rw-r--r-- | MDK/Common/Func.pm | 2 | ||||
-rw-r--r-- | MDK/Common/String.pm | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/MDK/Common/Func.pm b/MDK/Common/Func.pm index 7f1a926..e954a0b 100644 --- a/MDK/Common/Func.pm +++ b/MDK/Common/Func.pm @@ -322,7 +322,7 @@ sub cdie { my ($err) = @_; foreach (@MDK::Common::Func::cdie_catches) { $@ = $err; - if (my $v = &{$_}(\$err)) { + if (my $v = $_->(\$err)) { return $v; } } diff --git a/MDK/Common/String.pm b/MDK/Common/String.pm index bf8ac90..2325623 100644 --- a/MDK/Common/String.pm +++ b/MDK/Common/String.pm @@ -132,15 +132,14 @@ sub formatAlaTeX { sub warp_text { - my ($text, $width) = @_; - $width ||= 80; + my ($text, $o_width) = @_; my @l; foreach (split "\n", $text) { my ($beg) = /^(\s*)/; my $t = ''; foreach (split /\s+/, $_) { - if (length "$beg$t $_" > $width) { + if (length "$beg$t $_" > ($o_width || 80)) { push @l, "$beg$t"; $beg = ''; $t = $_; |