The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Image::Synchronize::ProgressBar - A simple progress bar that also works in closures.

SYNOPSIS

DESCRIPTION

This class implements a simple progress bar based on Term::ProgressBar, somewhat similar to Term::ProgressBar::Simple. The latter doesn't work well in closures; the current implementation does.

METHODS

new

  $pb = Image::Synchronize::ProgressBar->new(%options);

Creates a new instance of the progress bar. Accepts the following options (mostly similar to Term::ProgressBar):

count

The target count for the progress bar. When the progress count reaches this value, then the task is assumed to be complete.

fh

The filehandle to output to. Defaults to STDERR.

name

The name of the progress bar. This name is printed at the left-hand side of the progress bar.

show_bar

Should the progress bar be displayed? If set to a true value, then the progress bar is always displayed. If set to a false value, then the progress bar is not displayed, but the message method still prints to standard output (unlike for the silent option). If not set, then the progress bar is displayed only if the program detects that it is running interactively.

This option is not inherited from Term::ProgressBar.

silent

If set to a true value, then the progress bar does nothing. In particular, it does not print anything when you call the message method on it. Is ignored if show_bar is defined. For an alternative, see show_bar.

term_width

The width of the terminal. Use if the automatic detection fails.

The progress bar is removed when the task is complete, and displays an estimate of how long it will take for the task to complete.

add

  $pb->add($amount);
  $pb->add;                     # adds 1

Add the indicated $amount, or 1, toward the target of the progress bar.

done

  $pb->done;

Declare the task to be complete.

message

  $pb->message(@message);

Prints a message (like print), taking into account the progress bar.

DEPENDENCIES

This module uses the following non-core Perl modules:

AUTHOR

Louis Strous <LS@quae.nl>

LICENSE AND COPYRIGHT

Copyright (c) 2016-2018 Louis Strous.

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