Mail::A...KillDups(3)

πŸ“¦
version 2.228 Β· 2 versions
, in fedora 43

πŸ’– Mail::Audit::KillDups β€” the manual, but make it make sense πŸ’–

okay bestie, gather round, because this is the Mail::Audit plugin for duplicate suppression and it is lowkey iconic. it's a Perl thing (iykyk), it lives in the Mail::Audit ecosystem, and its whole personality is: "bestie we have already SEEN this email." ✨


✨ NAME ✨

Mail::Audit::KillDups β€” a Mail::Audit plugin that does duplicate suppression. that's it, that's the job, and it does it beautifully. πŸ’…


🌸 VERSION 🌸

this is version 2.228. periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the vibe, copy-paste ready:

use Mail::Audit qw(KillDups);
$Mail::Audit::KillDups::dupfile = "/home/simon/.msgid-cache";
my $mail = Mail::Audit->new;
$mail->killdups;

like. look at her. so clean. πŸŽ€


πŸ’œ DESCRIPTION πŸ’œ

so this is a Mail::Audit plugin, and what it gives you is a method for checking and suppressing duplicate messages β€” meaning mails with message-ids that have been previously seen. if we've met this message-id before? it's giving dΓ©jΓ  vu, and it's getting ignored. no cap. πŸ™ˆ

🧚 METHODS 🧚

killdups

this is the main character method. here's the tea:

  • it checks the incoming message against a file of previously seen message ids πŸ—‚οΈ
  • if it's already been seen, it ignores it πŸ’€
  • if it hasn't been seen, it adds it πŸ’–

and where does that file live? that's $Mail::Audit::KillDups::dupfile β€” that variable holds the name of the file used. if you don't set it, it defaults to .msgid-cache in the current directory. (which is, probably, your home directory.) 🏠

now here's the part where it gets spicy. the data in $Mail::Audit::KillDups::dupfile is treated as a ring buffer β€” the end of that buffer is delimited by two newline characters. when the file size goes over $Mail::Audit::KillDups::cache_bytes bytes, the message id gets written at the beginning of the file, and the old message ids in the file get overwritten. gone. evicted. rip to them. 🫑

the default cache size is 10000 bytes, which is enough space for about 200 message-ids. so it's cozy, but it's enough. 🌈

ngl, the semantics here are described as tortured. that's the original's word, not mine. the return values are as follows, and you will want to read them twice:
false - not a duplicate
+1    - an error occured during dupcheck
-1    - message is a duplicate

so yeah. false means not a dup, +1 means something went wrong during the dupcheck, and -1 means it IS a duplicate. honestly? iconic behavior. ⭐


πŸ‘‘ AUTHORS πŸ‘‘

  • Simon Cozens 🫢
  • Meng Weng Wong 🫢
  • Ricardo SIGNES 🫢

this software is copyright (c) 2000 by Simon Cozens. πŸ’œ

it's free software β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay. 🌸


and that's the whole page, bestie!! πŸ¦‹βœ¨ this was Mail::A...KillDups(3) from perl v5.42.0, dated 2025-07-25, brought to you by the User Contributed Perl Documentation. mwah, love u, go suppress some duplicates responsibly πŸ’…πŸ’–πŸŒˆ

πŸ“¦ where this page comes from