ePages 6.10 - DE_EPAGES/Core/API/Object/ProgressMonitor.pm

Package DE_EPAGES::Core::API::Object::ProgressMonitor

This module implements a progress monitor for command line.

Example
use DE_EPAGES::Core::API::Object::ProgressMonitor;

my $Progress = DE_EPAGES::Core::API::Object::ProgressMonitor->new(
    'ContentTemplate' => "%4d of %4d products exported.\n",
    'Total'          => 50,
    'Current'        => 0,
);
for (my $i=1;$i<=50;$i++) {
    $Progress->set('Current', $i);
    $Progress->write;
}

Functions

incCurrent
monitorThread
new
reset
sharedMonitor
write

incCurrent

return the current exported element

Syntax
$Current = $self->incCurrent;
Return
$Current (integer)
current status

monitorThread

return the package whos handles threads, used for call startMonitor().

Syntax
$MonitorThread = $self->monitorThread;
Return
$MonitorThread (package)
package handle thread DE_EPAGES::Core::API::Object::MonitorThread

new

starts the progress monitor for command line requests

Syntax
$ProgressMonitor = __PACKAGE__->new(%options);
Input
%options (hash)
following keys are used :
  • ContentTemplate - template for printf
  • Total - 100 percent
  • Current - current state (optional default=0)
  • SharedMonitor - shared monitor (starts at timeout
  • MonitorThread - thread for timeout
Return
$ProgressMonitor (object)
monitor

reset

resets the monitor sets internal Current = 0 and StartTime to now.

Syntax
$Monitor->reset;

sharedMonitor

return the shared monitor object, which is triggered if an timeout occurs.

Syntax
$SharedMonitor = $self->sharedMonitor;
Return
$SharedMonitor (object)
shared monitor DE_EPAGES::Core::API::Object::MonitorShared

write

write the monitor content

Syntax
$ProgressMonitor->write;