CCCP-HTML-Truncate version 0.01 =============================== TNAME CCCP::HTML::Truncate - truncate html with html-entities. SYNOPSIS use CCCP::HTML::Truncate; my $html = "

Ленин — жил

Ленин — жив

\n

Ленин — будет жить!

\n"; # -- CASE: Encode::is_utf8($html) eq '0'; print CCCP::HTML::Truncate->truncate($html,11,undef); #

Ленин — жил

… print CCCP::HTML::Truncate->truncate($html,11,' ☭'); #

Ленин — жил

☭i my $html = "

Ленин — жил

Ленин — жив

\n

Ленин — будет жить!

\n"; # -- CASE: Encode::is_utf8($html) eq '1'; print CCCP::HTML::Truncate->truncate($html,11,undef); #

Ленин — жил

… print CCCP::HTML::Truncate->truncate($html,11,' ☭'); #

Ленин — жил

☭ DESCRIPTION Truncate html string. Correct job with html entities. Validate truncated html. Check is_utf8 flag. METHODS truncate($str,$length,$elips) Class method. Return truncated html string. If turn 'is_utf8' flag on source html, return html with numeric entities, otherwise return strin in $Patched::HTML::Truncate::enc encoding. PACKAGE VARIABLES $Patched::HTML::Truncate::enc Default 'koi8-r' SEE ALSO "HTML::TreeBuilder", "Encode", "HTML::Entities", unicode regexp AUTHOR Ivan Sivirinov