Farhad Fouladi > Text-ProgressBar > Text::ProgressBar



Annotate this POD


Open  1
View/Report Bugs
Module Version: 0.3   Source  


Text::ProgressBar - indicates the progress of a lengthy operation visually on your terminal


Version 0.3


    use Text::ProgressBar::Bar;

    my $pbar = Text::ProgressBar->new();
    for my $i (1..100) {
        sleep 0.2;


The Text::ProgressBar is customizable, you can specify different kinds of widgets so as you can create your own widget. It is also possible that you combine more than one widget to find your own style.

The printing (output ascii) characters can also be modified and changed. A default set is defined for each widget, but user can change them during calling constructor or later by calling the corresponding methods (see individual widget).

Each 'widget' draws a different text on the screen. For an example for each 'widget' see its class POD!

When implementing your own widget, you create an update method and pass a reference current object of ProgressBar to it. As a result, you have access to the ProgressBar methods and attributes.

Following 'widgets' (class inheritance structure illustrated) are currently implemented. They can be used or extended or a new widgets can be created similar to them.

    |-- AnimatedMarker
    |-- Counter
    |-- FileTransferSpeed
    |-- Percentage
    |-- SimpleProgress
    |-- Timer
    |   |-- ETA
    |   `-- FormatLabel
    `-- WidgetHFill
        `-- Bar
            |-- BouncingBar
            `-- ReverseBar

Useful methods and attributes include (Public API):




Tries to catch resize signals sent from the terminal


handle terminal window resize events (transmitted via the WINCH signal)


builder for all widgets - used by Moose


Returns the progress as a percentage


format all widgets


Joins the widgets and justifies the line


Returns whether the ProgressBar should redraw the line


Checks all widgets for the time sensitive bit


Updates the ProgressBar to a new value.


Starts measuring time, and prints the bar at 0%


Puts the ProgressBar bar in the finished state.


Farhad Fouladi, <farhad at cpan.org>


Please report any bugs or feature requests to bug-text-progressbar at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-ProgressBar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Text::ProgressBar

You can also look for information at:


'Nilton Volpato' for original idea


There are many 'ProgressBar' in CPAN written in Perl. But only through this module user can choose from a set of different 'widgets' in different forms and behaviours and addititionally combine these widgets to make a nicer output.

There are currently a good number of widgets, you can put them in any type in any order, but you can write your own widget. A new user-defined widget can be easily implemented. Herefor user can add a new subclass of existing widgets and add his own widget with new functionalities in it.

This module support resizing of terminal during execution, not all other 'ProgressBar' module support that.

Some of the other modules:

Smart::Comments, Term::ProgressBar, Term::Spinner, String::ProgressBar, ProgressBar::Stack


Copyright 2012 Farhad Fouladi.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: