ProgressMonitor::SubTask - a monitor implementation that wraps another monitor in order to propagate the correct number of ticks to the parent.
... # call someTask and give it a monitor to print on stdout # someTask(ProgressMonitor::Stringify::ToStream->new({fields => [ ... ]})); sub someTask { my $monitor = shift; monitor->prepare; # we gather we have 3215 things to do, but only 215 of them are done by us # the others will be accomplished by anotherTask # monitor->begin(3215); for (1..215) { ...do part of the work... monitor->tick(1); } # farm out 3000 units of work to anotherTask # regardless how many units it will use for begin(), the net result is that our monitor will # work its way to 3000 ticks # anotherTask(ProgressMonitor::SubTask->new({parent => monitor, parentTicks => 3000}); monitor->end; } sub anotherTask { my $monitor = shift; monitor->prepare; # we're unaware of what kind of monitor we've gotten, nor do we care. # In this sample it'll be a SubTask, so it will scale our 189 units into the 3000 # monitor->begin(189); for (1..189) { ...do part of the work... monitor->tick(1); } monitor->end; }
This is a special implementation of the ProgressMonitor interface. It takes another monitor as its parent, and a number of ticks it can use of the number allotted to the parent. It will scale its own ticks to the parent.
Inherits from AbstractStatefulMonitor.
Configuration data:
The parent monitor.
The number of ticks to use from the parent.
Describes whether setMessage calls should be forwarded to the parent.
Kenneth Olwing, <knth at cpan.org>
<knth at cpan.org>
I wouldn't be surprised! If you can come up with a minimal test that shows the problem I might be able to take a look. Even better, send me a patch.
Please report any bugs or feature requests to bug-progressmonitor at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ProgressMonitor. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-progressmonitor at rt.cpan.org
You can find general documentation for this module with the perldoc command:
perldoc ProgressMonitor
Thanks to my family. I'm deeply grateful for you!
Copyright 2006,2007 Kenneth Olwing, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install ProgressMonitor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ProgressMonitor
CPAN shell
perl -MCPAN -e shell install ProgressMonitor
For more information on module installation, please visit the detailed CPAN module installation guide.