Term::Activity - Process Activity Display Module - v1.12
================================================================================
SYNOPSIS:
================================================================================
This module is designed to produce informational STDERR output while a
process is funinctioning over many iterations or outputs. It is instanced
with an optional name and other configurable values and is then called on
each iterative loop.
================================================================================
INSTALLATION:
================================================================================
To install this module type the following:
perl Makefile.PL
make
make test
make install
================================================================================
DESCRIPTION:
================================================================================
The information displayed is the current time processed (measured since
the instancing of the module), the number of actions second, a text-graphic
indicator of activity (skinnable), and the total count of actions thus far.
An example output (on a small terminal) might appear like this:
03:13:54 1 : [~~~~~~~~~~~~~~~~~\_______________] 9,461
Showing that nearly three hours and 14 minues have occured with a
current rate of 1 action per second, for a total of 9,461 total actions.
(For the curious, the skin shown is the default skin, AKA 'wave')
The display occurs on a single line that is updated regularly. The
display automatically calibrates itself so that it appears to update
approximately once a second.
When the Term::Activity module passes out of scope it updates the display
with the final time, count, and a newline before exiting.
Term::Activity can resize itself to the width of the current window if
Term::Size is installed. If not, it defaults to an 80-character display.
Term::Size is thouroughly reccomended.
================================================================================
USAGE:
================================================================================
Basic Usage:
my $ta = new Term::Activity;
while ( doing stuff ) {
$ta->tick;
}
Process labels:
You can label the output with a string to be displayed along with the
other output. This is handy for scripts that go through multiple
processess.
You can either instance them as a scalar value:
my $ta = new Term::Activity 'Batch7';
Or via a configuration hash reference:
my $ta = new Term::Activity ({ label => 'Batch7' });
Also, through the course of processing, you can change the label.
$ta->relabel("New Label");
Skins:
Skins can be selected via a configuration hash reference. Currently there
are two skins 'wave' and 'flat.' "Wave" is the default skin.
my $ta = new Term::Activity ({ skin => 'flat' });
The "flat" skin cycles through a series of characters. You may also
provide an arrayreference of your favorite characters if you'd like
different ones:
my $ta = new Term::Activity ({
skin => 'flat',
chars => [ '-', '=', '%', '=', '-' ]
});
Start Time:
The start time for the process timer is initialized when the
Term::Activity is created. Sometimes, with longer programs you want the
count to remain constant through several different forms of processing.
You can set the start time to a previous start time to do this.
The parameter is called 'time' in the initilization hash:
my $start_time = time;
# Stuff happens
my $ta = new Term::Activity ({
time => $start_time
});
Debug:
By setting the debug parameter to 1 a very verbose debug output is
produced along with the regular output to let you see settings have been
selected and what computations are being performed.
my $ta = new Term::Activity ({
debug => 1
});
Multiple Instances:
As stated above, when the Term::Activity module passes out of scope it
updates the display with the final time, count, and a newline before exiting.
Consuquently if you would like to use Term::Activity multiple times in a
single program you will need to undefine the object and reinstance it:
my $ta = new Term::Activity;
while ( doing stuff ) {
$ta->tick;
}
$ta = undef;
$ta = new Term::Activity;
while ( doing more stuff ) {
$ta->tick;
}
(lather. rinse. repeat.)
================================================================================
KNOWN ISSUES:
================================================================================
Resizing the window during execution may cause the status bar to stop
refreshing properly.
Is the window is too small to accomodate the time, label, count, and
basic spacing (that is, there is less that 0 spaces for the activity to
be displayed) the effect, while being preety in a watching-the-car-wreck
way, it is not informative. Remember to keep your label strings short.
================================================================================
AUTHORSHIP:
================================================================================
Term::Activity v1.12 2013/05/17
(c) 2003-2013, Phillip Pollard <bennie@cpan.org>
Released under the Perl Artistic License
Additional contributions by Kristina Davis <krd@menagerie.tf>
Derived from Util::Status 1.12 2003/09/08
With permission granted from Health Market Science, Inc.