Tib
Posted on March 6, 2021
Log::Progess is Perl module to display progress in a configurable manner.
Install Log::Progress
Install as usual with cpanm Log::Progress
:
$ cpanm Log::Progress
Fetching http://www.cpan.org/authors/id/N/NE/NERDVANA/Log-Progress-0.12.tar.gz ... OK
Configuring Log-Progress-0.12 ... OK
Building and testing Log-Progress-0.12 ... OK
Successfully installed Log-Progress-0.12
1 distribution installed
At this point you shoule be able to use Log::Progress
in your program without any complaints from perl
π
Report progress
This is what contains my sample below:
- Creation of a progress
- Configure when to report progress
- Set the max and current progress
- Actually progress (and let
Log::Progress
report when appropriate)
use Log::Progress;
my $progress= Log::Progress->new();
$progress->squelch(.1); # Only emit messages every 10%
my $max = 20;
$progress->at(0, $max); # Set current progress and target
for (my $i = 1; $i <= $max; $i++) {
sleep 1;
$progress->at($i); # Will not report each time
}
And then I get this progress report:
π πͺ π
π©
Tib
Posted on March 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.