Brandon L Black > Term-Spinner > Term::MultiSpinner

Download:
Term-Spinner-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Term::MultiSpinner - Term::Spinner with multiple spinners

SYNOPSIS ^

  use Term::MultiSpinner;

  my $spinner = Term::MultiSpinner->new();
  while(... a complicated async loop ...) {
      if(... can read some data ...) {
          $spinner->advance(0);
          # read stuff
          $spinner->finish(0) if $done_reading;
      }
      if(... can write some data ...) {
          $spinner->advance(1);
          # write stuff
          $spinner->finish(1) if $done_writing;
      }
  }
  undef $spinner; # clears final spinner output by default.

DESCRIPTION ^

This is a subclass of Term::Spinner, see those docs first.

This class provides multiple spinners on the same line, to represent the state of several asynchronous long-running tasks. Ideal for a complex select-based loop, a POE process, etc.

Another good place to use it is if you have a long queue of short tasks to complete and can only do a small number in parallel at a time. Use the first spinner to indicate when a task is taken from the queue and started, and the second spinner to indicate task completion.

The docs below only indicate deviations from the interface of Term::Spinner, see those docs for the basic information.

METHODS ^

clear

draw

advance

Requires an argument, which is the integer spinner slot to advance. The first spinner is 0. The number of spinners on the screen will always automagically expand to include the entire range of 0 through the highest number you've directly accessed.

finish

Requires an argument, which is the integer spinner slot to finish. The first spinner is 0. The number of spinners on the screen will always automagically expand to include the entire range of 0 through the highest number you've directly accessed.

advance_all

Calls "advance" on all spinners.

finish_all

Calls "finish" on all spinners.

AUTHOR ^

Brandon L. Black, <blblack@gmail.com>

COPYRIGHT AND LICENSE ^

Copyright 2007 Brandon L. Black

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: