thanks
Mike
> I can't quite recall the printing term so please bear with me.
> When you want your user to know that something is happening the
> app often will print to the screen saying something like "load
> ...". I want to create the same sort of script that produce a "."
> or similar symbol for each fraction of second that goes by.
Why? Does your user not have a watch or something?
> If I knew the 'key' words I'd search for it.
I would be much more interested in knowing how much 'progress' is
being made.
For example, I once wrote a script to generate 1536 png files after
some data processing. It ran in about 20 minutes.
### pseudo code
{
my $progress = 0;
while ( $datasets->next ) {
# process data set
++ $progress;
print STDERR '.' unless $progress % 100;
}
}
###
so that a dot was printed every time 100 data sets were completed.
In this throaway script, I used STDERR because STDOUT actually had
other important output going to it.
Sinan
--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
print? Which part of the program are you having a problem with?
Something like
use Time::HiRes qw/sleep/;
$| = 1;
print 'loading';
for (1..100) {
sleep 0.1;
print '.';
}
print "\n";
works, but presumably you don't *just* want to mark the passage of time.
Ben
Your code is almost exactly what I had. But what is the "$| = 1;"
for?
Mike
See "perldoc perlvar"
jue
perldoc perlvar | grep '$|'
--
Steven O'Neill ste...@panix.com
Brooklyn, NY http://www.panix.com/~steveo
Thanks everyone The missing link was the $| = 1;
Mike
I had something like that, then decided to show progress once a second
(instead of per 100 or per 1000 items).
-Joe
my($progress_time,$count);
sub wanted {
$directories{$File::Find::name} = 1 if -d $_;
return unless -f _; # Skip symlinks and such
push @files,$File::Find::name;
++$count;
if ($verbose) { # Once a second, output number of files found
my $now = time;
$progress_time ||= $now;
print " $count" if $now > $progress_time;
$progress_time = $now;
}
}