1Mail::SpamAssassin::UtiUls:e:rPrCoognrtersisb(u3t)ed PerMlaiDlo:c:uSmpeanmtAastsiaosnsin::Util::Progress(3)
2
3
4
6 Mail::SpamAssassin::Util::Progress - Progress bar support for
7 SpamAssassin
8
10 my $progress = Mail::SpamAssassin::Util::Progress->new({total => 100});
11
12 $msgcount = 0;
13 foreach my $message (@messages) {
14 # do something here
15 $msgcount++;
16 $progress->update($msgcount);
17 }
18
19 $progress->final();
20
22 This module implements a progress bar for use in SpamAssassin scripts
23 and modules. It allows you to create the progress bar, update it and
24 print out the final results of a particular run.
25
26 new
27 public class (Mail::SpamAssassin::Util::Progress) new (\% $args)
28
29 Description: Creates a new Mail::SpamAssassin::Util::Progress object,
30 valid values for the $args hashref are:
31
32 total (required)
33 The total number of messages expected to be processed. This item
34 is required.
35
36 fh [optional]
37 An optional filehandle may be passed in, otherwise STDERR will be
38 used by default.
39
40 term [optional]
41 The module will attempt to determine if a valid terminal exists on
42 the STDIN filehandle. This item allows you to override that value.
43
44 init_bar
45 public instance () init_bar()
46
47 Description: This method creates the initial progress bar and is called
48 automatically from new. In addition you can call init_bar on an
49 existing object to reset the bar to it's original state.
50
51 update
52 public instance () update ([Integer $num_done])
53
54 Description: This method is what gets called to update the progress
55 bar. You may optionally pass in an integer value that indicates how
56 many messages have been processed. If you do not pass anything in then
57 the num_done value will be incremented by one.
58
59 final
60 public instance () final ([Integer $num_done])
61
62 Description: This method should be called once all processing has
63 finished. It will print out the final msgs per sec calculation and the
64 total time taken. You can optionally pass in a num_done value,
65 otherwise it will use the value calculated from the last call to
66 update.
67
68
69
70perl v5.36.0 2023-01-M2a1il::SpamAssassin::Util::Progress(3)