I have similar setup right now and when you get long lines like "/etc/sysconfig/network-scripts/ifcfg-bond0" plus the "<-- 90 (9/10) complete -->" it turn into a line that is too large for some terms and looks bad.
Using "\e[K" seems to be better with my experience since there is no need to figure out the length of the previous output.
my @dirs = map {chomp; $_} <DATA>;
local $| = 1;
my $i = 0;
for my $dir (@dirs) {
$i++;
my $output = int($i / @dirs * 100) . "% ($i/" . @dirs . ")";
print "\e[K<-- $output complete, $dir -->\r";
sleep 1;
}
print "\n";
The thing I think I haven't figured out with ncurses/term::cap/term::screen/etc is that I don't know how to determine the current line/row of the screen I am currently on. I can put text anyplace any want easily but can't get seem to understand how to determine the current line/row.
Am I just missing the existing function to do that?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.