HTML::Trim is a Perl module for trimming HTML text to specified bytes or text length.
Sometimes, we want to set in formatted HTML texts which is input by user. HTML::Trim is useful for the purpose.
use HTML::Trim qw(htrim hvtrim); my $trimmed = hvtrim('foo bar <a href="/">baz</a> fumino', 10, '…'); #=> 'foo bar <a href="hoge">b</a>…'
HTML::Trim provide two functions, one of it is trimming by byte length named "htrim" or "HTML::Trim::trim" and another by character (considering multibyte east-asian characters) length named "hvtrim" or "HTML::Trim::vtrim". You should use vtrim for universal use.
[[perl]] [[cpan]]