The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::Pyzor::Digest::StripHtml

SYNOPSIS

my $stripped = Mail::Pyzor::Digest::StripHtml::strip($html);

DESCRIPTION

This module attempts to duplicate pyzor’s HTML-stripping logic.

ACCURACY

This library cannot achieve 100%, bug-for-bug parity with pyzor because to do so would require duplicating Python’s own HTML parsing library. Since that library’s output has changed over time, and those changes in turn affect pyzor, it’s literally impossible to arrive at a single, fully-compatible reimplementation.

That said, all known divergences between pyzor and this library involve invalid HTML as input.

Please open bug reports for any divergences you identify, particularly if the input is valid HTML.

FUNCTIONS

$stripped = strip( $HTML )

Give it some HTML, and it’ll give back the stripped text.

In general, the stripping consists of removing tags as well as <script> and <style> elements; however, it also removes HTML entities.

This tries very hard to duplicate pyzor’s behavior with invalid HTML.