Mail::...ogress(3pm)

✨ Mail::SpamAssassin::Util::Progress β€” progress bar support for SpamAssassin ✨

okay bestie so this little icon lives in the User Contributed Perl Documentation corner of the perl universe πŸ’… it's Mail::SpamAssassin::Util::Progress(3pm) and it is literally the glow-up your SpamAssassin scripts have been waiting for πŸŽ€


🌸 NAME 🌸

Mail::SpamAssassin::Util::Progress β€” progress bar support for SpamAssassin πŸ¦‹


✨ SYNOPSIS ✨

my $progress = Mail::SpamAssassin::Util::Progress->new({total => 100});

$msgcount = 0;
foreach my $message (@messages) {
  # do something here
  $msgcount++;
  $progress->update($msgcount);
}

$progress->final();

like. look at that loop. she's looping AND she's updating AND she's slaying πŸ’–


πŸ’œ DESCRIPTION πŸ’œ

This module implements a progress bar for use in SpamAssassin scripts and modules. It lets you create the progress bar, update it, and print out the final results of a particular run. it's giving main character energy for your terminal, no cap 🫢


πŸŽ€ new πŸŽ€

public class (Mail::SpamAssassin::Util::Progress) new (\% $args)

Description: Creates a new Mail::SpamAssassin::Util::Progress object. valid values for the $args hashref are, bestie, as follows:

  • total (required) β€” the total number of messages expected to be processed. this item is required. like, genuinely required. no total, no bar. periodt 🚨
  • fh [optional] β€” you may pass in an optional filehandle. if you don't, STDERR gets used by default. so that's the default, lowercase default, fr fr πŸ’…
  • term [optional] β€” the module will attempt to determine if a valid terminal exists on the STDIN filehandle. this item lets you override that value. in case the vibes on STDIN are misleading, yk? πŸ™ˆ

πŸ¦‹ init_bar πŸ¦‹

public instance () init_bar()

Description: This method creates the initial progress bar and is called automatically from new. plot twist: you can also call init_bar on an existing object to reset the bar back to it's original state. it's giving factory reset but make it cute 🌈


⭐ update ⭐

public instance () update ([Integer $num_done])

Description: This method is what gets called to update the progress bar. You may optionally pass in an integer value that indicates how many messages have been processed. if you do not pass anything in, then the num_done value will be incremented by one. so yes, it just adds one for you, she's thoughtful like that πŸ˜­πŸ’–


πŸ‘‘ final πŸ‘‘

public instance () final ([Integer $num_done])

Description: This method should be called once all processing has finished. It will print out the final msgs per sec calculation and the total time taken. You can optionally pass in a num_done value, otherwise it will use the value calculated from the last call to update. so like, the bar has receipts. she remembers. πŸ“Šβœ¨

also quick note bestie, that header spells the name with an ellipsis in it (Mail::...ogress) and honestly? we're not fixing it. we're honoring it. iconic behavior πŸ’€

that's the whole page! 🫢 written up in User Contributed Perl Documentation for perl v5.40.1, dated 2026-07-23 β€” go make your SpamAssassin runs look pretty, you absolute legend, mwah πŸ’…πŸ’–πŸŒΈ

πŸ“¦ where this page comes from