While this piece of code is a spinner, not a progress bar .
This is waiting for a log file to end
sub waitForCmd {
my $href = shift(@_);
# wait for the file
#
sleep 1 while ( ! -e "$href->{settings}->{runfolder}/$href->{se
+ttings}->{logfile}" );
open( FH ,'<', "$href->{settings}->{runfolder}/$href->{settings}->
+{logfile}" );
# keep track of spinner
#
my @sails = map { "\b$_" } qw{- \ | /};
my $sail = 0;
# now search each line for job completed
#
FILE:
for (;;) {
while (<FH>) {
print $sails[$sail++ % @sails] ;
last FILE, if ( $_ =~ /Stopping AppMonitor Connector/ );
}
seek(FH, 0, 1);
}
close (FH);
return;
}
"We can't all be happy, we can't all be rich, we can't all be lucky – and it would be so much less fun if we were. There must be the dark background to show up the bright colours."
Jean Rhys (1890-1979)
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.