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 SpamAssassin
7
9 my $progress = Mail::SpamAssassin::Util::Progress->new({total => 100});
10
11 $msgcount = 0;
12 foreach my $message (@messages) {
13 # do something here
14 $msgcount++;
15 $progress->update($msgcount);
16 }
17
18 $progress->final();
19
21 This module implements a progress bar for use in SpamAssassin scripts
22 and modules. It allows you to create the progress bar, update it and
23 print out the final results of a particular run.
24
25 new
26
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
46 public instance () init_bar()
47
48 Description: This method creates the initial progress bar and is called
49 automatically from new. In addition you can call init_bar on an exist‐
50 ing object to reset the bar to it's original state.
51
52 update
53
54 public instance () update ([Integer $num_done])
55
56 Description: This method is what gets called to update the progress
57 bar. You may optionally pass in an integer value that indicates how
58 many messages have been processed. If you do not pass anything in then
59 the num_done value will be incremented by one.
60
61 final
62
63 public instance () final ([Integer $num_done])
64
65 Description: This method should be called once all processing has fin‐
66 ished. It will print out the final msgs per sec calculation and the
67 total time taken. You can optionally pass in a num_done value, other‐
68 wise it will use the value calculated from the last call to update.
69
70
71
72perl v5.8.8 2008-01-M0a5il::SpamAssassin::Util::Progress(3)