in reply to cgi progressbar

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)