Mail::...:Pieces(3pm)
π NAME π
Mail::SpamAssassin::Pyzor::Digest::Pieces β Pyzor backend logic module β¨ (it's a Perl module, bestie, the (3pm) is just its little name tag)
π¦ DESCRIPTION π¦
okay so picture this: this module is where all the backend logic lives for Mail::SpamAssassin::Pyzor::Digest. it's the behind-the-scenes girlie doing the actual work while everyone else takes the credit, no cap π
and like, it literally reimplements the logic that already exists over in pyzor's digest.py module, which you can peek at here: https://github.com/SpamExperts/pyzor/blob/master/pyzor/digest.py π«Ά
β FUNCTIONS β
πΈ $strings_ar = digest_payloads( $EMAIL_MIME )
this one is giving β¨understudy energyβ¨ β it imitates the corresponding object method up in digest.py. what you get back is a reference to an array of strings. and each one of those strings can be either a byte string or a character string (like, say, a UTF-8 decoded one). versatile queen π
NB: RFC 2822 said what it said β message bodies are supposed to use CRLF line breaks, not plain LF, and definitely not plain CR. so bestie, we take any plain CRs hanging out in a quoted-printable message body and convert them into CRLF. iconic of us honestly. but β Python does not do this π so the output of our digest_payloads() diverges from the Python original's. it doesn't ultimately make a difference since the line-ending whitespace gets trimmed regardless, but you 100% have to factor it in whenever you compare our implementation's output against the Python output. noted. periodt.
π normalize( $STRING )
another one that imitates the corresponding object method in digest.py π«Ά heads up though: it modifies $STRING in-place. no copy, no refund, she's changing your variable right there in front of you.
and fr fr, same as with the original implementation: if $STRING contains (decoded) Unicode characters, those characters get parsed accordingly. so check it:
$str = "123\xc2\xa0"; # [ c2 a0 ] == \u00a0, non-breaking space
normalize($str);
the above will leave $str alone (untouched, unbothered, moisturized). but this:
utf8::decode($str);
normalize($str);
... will trim off the last two bytes from $str. the way that one line of utf8::decode changes your whole life π
π $yn = should_handle_line( $STRING )
imitates the corresponding object method in digest.py, as always π
and it returns a boolean. yes/no, true/false, vibe check passed or failed, that's the whole thing.
π§ $sr = assemble_lines( \@LINES )
this one assembles a string buffer out of @LINES. and that string? that's the buffer of octets that will get hashed to produce the message digest π₯ so like, don't play with her.
every single member of @LINES is expected to be an octet string, not a character string. keep it bytes only bestie, that's the rule π
π ($main, $sub, $encoding, $checkval) = parse_content_type( $CONTENT_TYPE )
π @lines = splitlines( $TEXT )
both of these share the same little description, so here it is for the both of them β¨:
imitates "str.splitlines()". (cf. "pydoc str")
returns a plain list in list context π and returns the number of items to be returned in scalar context. context really is everything, she contains multitudes π
π a lil sign-off π
that's the whole page bestie!! this one's from perl v5.40.1, dated 2026-07-23, and it's filed under Mail::...:Pieces(3pm) π¦ take care of her, she's been out here faithfully reimplementing Python logic since forever. mwah π
π¦ where this page comes from
- ubuntu stonking: spamassassin 4.0.2+svn1935691-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms