How to print question

M

mmccaws2

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. If I knew the 'key' words
I'd search for it.

thanks

Mike
 
A

A. Sinan Unur

2g2000hsn.googlegroups.com:
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 <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
B

Ben Morrow

Quoth mmccaws2 said:
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. If I knew the 'key' words
I'd search for it.

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
 
M

mmccaws2

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top