NAME

ProgressMonitor::SubTask - a monitor implementation that wraps another monitor in order to propagate the correct number of ticks to the parent.

SYNOPSIS

  ...
  # 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;
  }

DESCRIPTION

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.

METHODS

new( $hashRef )

Configuration data:

parent

The parent monitor.

parentTicks (default => 1)

The number of ticks to use from the parent.

passMessageToParent (default => 0)

Describes whether setMessage calls should be forwarded to the parent.

AUTHOR

Kenneth Olwing, <knth at cpan.org>

BUGS

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.

SUPPORT

You can find general documentation for this module with the perldoc command:

perldoc ProgressMonitor

ACKNOWLEDGEMENTS

Thanks to my family. I'm deeply grateful for you!

COPYRIGHT & LICENSE

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.