Hi Monks,

I've RTFM'd and STFW'd but found no enlightenment.

I have successfully been using Term::ProgressBar to monitor my prog's processing of a file. I now want to extend the program to process multiple files. Aha, I thought to myself, it would be nice to have two ProgressBars, one above the other: one to monitor progress through the file set; and one to monitor progress in the file currently being processed. However, this doesn't seem possible. Only one bar is displayed at a time, the last one to be created.

My program is too long long to post here, but here is an example adapted from one of the examples in the Term::ProgressBar package:

#!/usr/bin/perl use warnings; use strict; use Term::ProgressBar 2.00; use constant MAX => 100_000; my $run_progress = Term::ProgressBar->new({name => 'Run', count => 1 +0, remove => 1}); $run_progress->minor(0); my $run_update = 0; for (0..10) # the outer run { my $powers_progress = Term::ProgressBar->new({name => "Powers$_", co +unt => MAX, remove => 1}); $powers_progress->minor(0); my $powers_update = 0; for (0..MAX) { my $is_power = 0; for(my $i = 0; 2**$i <= $_; $i++) { $is_power = 1 if 2**$i == $_; } $powers_update = $powers_progress->update($_) if $_ >= $powers_update; } $powers_progress->update(MAX) if MAX >= $powers_update; $run_update = $run_progress->update($_) if $_ >= $run_update; #print "\n"; }

Running this shows only the powers_progress bars, and not the run_progress bars. Commenting in the print statement on the 2nd to last line displays the run_progress bar as a "snap shot".

Is what I am trying to do even possible? I'm truly stuck on this problem.

Thanks in advance for any help,

poshboy

p.s. this is my first post to the Monks, so please excuse any mistakes I've made!


In reply to Simultaneous Term::ProgressBars? by poshboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.