Subject: | [PATCH] new attribute auto_reset |
Date: | Sat, 9 Feb 2008 19:00:23 -0200 |
To: | "Alex Bowley" <kilinrax [...] cpan.org>, bug-html-strip <bug-HTML-Strip [...] rt.cpan.org> |
From: | "Adriano Ferreira" <a.r.ferreira [...] gmail.com> |
Hi, Alex.
The attached patch implements a new attribute for the HTML::Strip
parser objects. This is "auto_reset" which may be included in the
attributes in the constructor or setted via a new method
"set_auto_reset".
Its reason to be is to toogle the parsers into a one-shot operation
where the state is reset after each call to "parse".
So when people don't intend to use HTML::Strip objects to parsing in
chunks, the usage changes from
$h = HTML::Strip->new
$h->parse( $html1 );
$h->eof;
$h->parse( $html2 );
$h->eof;
$h->parse( $html3 );
$h->eof;
into
$h = HTML::Strip->new( auto_reset => 1 );
$h->parse( $html1 ); # reset is automatic after parsing
$h->parse( $html2 );
$h->parse( $hmtl3 );
Best,
Adriano Ferreira
Message body is not shown because sender requested not to inline it.