Progress::Any update

This is an update to the post where I introduced Progress::Any a few months ago. Progress::Any is a framework that separates progress updating and outputting.

I have recently revised the API (sadly not backward compatible with old one). It now resembles Log::Any a bit further. In module code, we just need to use Progress::Any to get progress indicator, set position and target, and update the indicator while doing work:

package MyApp;
use Progress::Any;

sub download {
    my @urls = @_;
    return unless @urls;
    my $progress = Progress::Any->get_indicator(task => "download");
    for my $url (@urls) {
        # download the $url ...
        $progress->update(message => "Downloaded $url");

In application code, we use Progress::Any::Output to set (or add) output:

use MyApp;
use Progress::Any::Output;

Hierarchy now works. If you add a subtask, the parent tasks will get updated

Progress::Any now handles the calculation of times (elapsed, ETA) so output
modules can share this code and become much more simpler.

I've replaced the TermProgressBar output which uses Term::ProgressBar with
TermProgressBarColor (currently the code is preliminary, but I plan a much more
prettier output with lots of options, like animations, color themes, and
styles). I've also added a couple other outputs for examples: TermMessage and

If you want to see how it looks:

% cpanm -n Progress::Any::Output Progres::Any::Output::TermProgressBarColor
% perl -MProgress::Any='$progress' -MProgress::Any::Output -MTime::HiRes=sleep \
       for (1..70) { $progress->update(message=>"Update #$_ ..."); sleep 0.1 }'

Leave a comment

About Steven Haryanto

user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.