Subject: | as_trimmed_text in HTML::Element does not trim |
sub as_trimmed_text {
my $text = shift->as_text(@_);
$text =~ s/[\n\r\f\t ]+$//s;
$text =~ s/^[\n\r\f\t ]+//s;
$text =~ s/[\n\r\f\t ]+/ /g;
return $text;
}
This fails to trim from $text which is commonly used in HTML
The following would resolve the problem:
sub as_trimmed_text {
my $text = shift->as_text(@_);
$text =~ s/[\n\r\f\t\xA0 ]+$//s;
$text =~ s/^[\n\r\f\t\xA0 ]+//s;
$text =~ s/[\n\r\f\t\xA0 ]+/ /g;
return $text;
}