
HTML::Split - Splitting HTML by number of characters with keeping DOM structure.

use HTML::Split; my $html = <<HTML; <div class="pkg"> <h1>HTML::Split</h1> <p>Splitting HTML by number of characters.</p> </div> HTML; my @pages = HTML::Split->split(html => $html, length => 50); # $pages[0] <div class="pkg"> # <h1>HTML::Split</h1> # <p>Splittin</p></div> # $pages[1] <div class="pkg"> # <p>g HTML by number of characters.</p></div>

HTML::Split is the module to split HTML by number of characters with keeping DOM structure.
In some mobile devices, mainly cell-phones, because the data size that can be acquired with HTTP is limited, it is necessary to split HTML.
This module provide the method of splitting HTML without destroying the DOM tree for such devices.

Split HTML text by number of characters. It can accept below parameters with hash.
HTML string.
The length (characters) per pages.
Defining regexp of description that can not split. For example, your original markup to show emoticon '[E:foo]':
extend_tags => [
{
full => qr/\[E:[\w\-]+\]/,
begin => qr/\[[^\]]*?/,
end => qr/[^\]]+\]/,
},
]
Completely matching pattern of your original markup.
The beginning pattern to find your original markup.
The ending pattern of your original markup.
This will be deprecated. Please use HTML::Split::Pager instead.

Hiroshi Sakai <ziguzagu@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.