X-Git-Url: https://git.donarmstrong.com/?p=term-progressbar.git;a=blobdiff_plain;f=eg%2Fsmooth_bar.pl;fp=eg%2Fsmooth_bar.pl;h=befae9aab0ad5d1917feeb4c713487d7baec1c8c;hp=0000000000000000000000000000000000000000;hb=33e231ca939cbe1231c82a60d2ba7f8461b659e3;hpb=9ba26e4bf76c371d7b7ab153c676510831816e2e diff --git a/eg/smooth_bar.pl b/eg/smooth_bar.pl new file mode 100644 index 0000000..befae9a --- /dev/null +++ b/eg/smooth_bar.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Term::ProgressBar 2.00; + +my $max = shift || 100; + +my $progress = Term::ProgressBar->new($max); + +for (0..$max) { + my $is_power = 0; + for(my $i = 0; 2**$i <= $_; $i++) { + $is_power = 1 + if 2**$i == $_; + } + + $progress->update($_) +}