Subject: | infinite loop with certain inputs |
This never returns:
perl -MText::Elide=elide -E 'say elide(shift,16)' "terrifyingly, a large
dog elided my string"
This fixes it:
diff --git a/Elide.pm b/Elide.pm
index e797cdd..9ad7b11 100644
--- a/Elide.pm
+++ b/Elide.pm
@@ -68,7 +68,7 @@ sub elide
{
### require: length( $string ) + length( $elipsis ) > $length
### require: $string =~ /\s+\S+/
- $string =~ s/\s+\S+$//;
+ $string =~ s/\s+\S+$// or last;
### require: length( $string ) > 0
}
### require: length( $string ) + length( $elipsis ) <= $length