Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the String-Truncate CPAN distribution.

Report information
The Basics
Id: 45493
Status: resolved
Priority: 0/
Queue: String-Truncate

People
Owner: Nobody in particular
Requestors: ferreira [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.102
Fixed in: (no value)



Subject: at_string does not bypass newlines
A minor test case can be: use String::Truncate qw(elide); my $s = $s = 'a ' x 20 . "\n\n" . 'b ' x 20; print elide($s, 50); # prints "a a a a a a a a a a a a a a a a a a a a \n\nb b b..." # but print elide($s, 50, {at_space=>1}); # prints "a a a a a a a a a a a a a a a a a a a a ..." The fix seems to be simple: just add \s modified in the regex used when "at_space" is specified. diff -ru String-Truncate-0.102/lib/String/Truncate.pm S-T/lib/String/Truncate.pm --- String-Truncate-0.102/lib/String/Truncate.pm 2007-07-23 14:45:08.000000000 - 0700 +++ S-T/lib/String/Truncate.pm 2009-04-27 12:52:55.000000000 -0700 @@ -73,7 +73,7 @@ if ($at_space) { - my ($substr) = $string =~ /\A(.{0,$keep})\s/; + my ($substr) = $string =~ /\A(.{0,$keep})\s/s; $substr = substr($string, 0, $keep) unless defined $substr and length $substr;
fixed in today's release -- rjbs