All hail the wise PerlMonks!!!!

i was hoping you ppl could help me as i am trying to make a curses Application. inside the application i need to run a few other bash scripts and i need a progress bar for the duration of the script. so basically i press a button to execute then go into another widget screen which shows me progress of the bash script.

$w{7}->add( 'progressbarlabel', 'Label', -x => -1, -y => 3, -width => 10, -border => 1, -text => "the time" ); $w{7}->add( undef, 'Label', -text => "The progressbar can be used to provide some progress inf +ormation\n" . "to the user of a program. Progressbars can be drawn in s +everal\n" . "ways (see below for a couple of examples). In this example, +I\n" . "just built a kind of clock (the values for the bars are \n" . "depending upon the current time)." ); $w{7}->add( undef, "Label", -y => 7, -text => "Showing value"); $w{7}->add( 'p1', 'Progressbar', -x => 15, -y => 6, -showvalue => 1 ); sub progressbar_timer_callback($;) { my $cui = shift; my $COMMAND = "bash Script.sh $ARGUMENT1"; $w{7}->getobj('p1')->get(`$COMMAND`); } $cui->set_timer( 'progressbar_demo', \&progressbar_timer_callback, 1 ); $cui->disable_timer('progressbar_demo'); $w{7}->onFocus( sub{$cui->enable_timer ('progressbar_demo')} ); $w{7}->onBlur( sub{$cui->disable_timer ('progressbar_demo')} );
i also tried this:
$w{12}->add( undef, 'Buttonbox', -y => 7, -buttons => [ { -label => "< Example 1 >", -onpress => sub { $cui->progress( -min => 0, -max => 700, -title => 'Progress dialog without a message', -nomessage => 1, ); for my $pos (`bash RunAllTest-test.sh $EMAIL`) { $cui->setprogress($pos); } sleep 1; $cui->noprogress; } },{ -label => "< Example 2 >", -onpress => sub { my $msg = "Counting from 0 to 700...\n"; $cui->progress( -min => 0, -max => 700, -title => 'Progress dialog with a message', -message => $msg, ); for my $pos (0..700) { $cui->setprogress($pos, $msg . $pos . " / 700"); } $cui->setprogress(undef, "Finished counting!"); sleep 1; $cui->noprogress; } } ] );
i noticed that the scripts was being run for both the methods but i wasnt getting any progress bar whatsoever and i had my screen cluttered with error even though the scripts ran and were succesfully completed.

i noticed that the examples provided are based solely on numbers and scalar quantities because of which i have been stuck as to how to do this! any help will do!! thanks!!!

In reply to Curses::Progressbar for a specific command or script. by monkkazimir

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.