Click here to get back home

How to print question

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to print question mmccaws2 04-17-2008
Posted by mmccaws2 on April 17, 2008, 10:47 am
Please log in for more thread options
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

Posted by A. Sinan Unur on April 17, 2008, 10:59 am
Please log in for more thread options
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

--
(remove .invalid and reverse each component for email address)

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

Posted by Ben Morrow on April 17, 2008, 11:02 am
Please log in for more thread options

> 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


Posted by mmccaws2 on April 17, 2008, 11:21 am
Please log in for more thread options
>
> > I can't quite recall the printing term so please bear with me. =A0 When
> > you want your user to know that something is happening the app often
> > will print to the screen saying something like "load ...". =A0I want to
> > create the same sort of script that produce a "." or similar symbol
> > for each fraction of second that goes by. =A0If I knew the 'key' words
> > I'd search for it.
>
> print? Which part of the program are you having a problem with?
> Something like
>
> =A0 =A0 use Time::HiRes qw/sleep/;
>
> =A0 =A0 $| =3D 1;
>
> =A0 =A0 print 'loading';
>
> =A0 =A0 for (1..100) {
> =A0 =A0 =A0 =A0 sleep 0.1;
> =A0 =A0 =A0 =A0 print '.';
> =A0 =A0 }
>
> =A0 =A0 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 "$| =3D 1;"
for?

Mike

Posted by Jürgen Exner on April 17, 2008, 11:34 am
Please log in for more thread options
>Your code is almost exactly what I had. But what is the "$| = 1;"
>for?

See "perldoc perlvar"

jue

Similar ThreadsPosted
Print question January 12, 2005, 12:11 am
odd chars in perldoc prior to 5.10.0 (was: Re: How to print question) April 17, 2008, 11:36 pm
newbie question on output formatting/"pretty" print April 16, 2006, 10:59 pm
(",) Print This! Press [Ctrl][P] Keys To Print... >> http://www.phpbbserver.com/phpbb/viewtopic.php?t=2&mforum=anysubjectchat < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < May 30, 2005, 2:05 pm
* * * Please Read And/Or Print This! * * * Press [Ctrl][P] Keys On Your Keyboard To Print >> June 1, 2004 8:24:38 pm >> http://115639.aceboard.net/forum2.php?rub=158&cat=61&login=115639&page=0#id96 << * * * * * * * * * * * * * * * * * * * * * * * * * * * June 1, 2005, 6:24 pm
print @ versus print @ September 25, 2005, 9:53 pm
difference between print < August 16, 2006, 1:16 pm
I want to ask you the most important question of your life. The question is: Are you saved? It is not a question of how good you are, nor if you are a church member, but are you saved? Are you sure you will go to Heaven when you die? The reason some peopl May 22, 2005, 10:11 am
I want to ask you the most important question of your life. The question is: Are you saved? It is not a question of how good you are, nor if you are a church member, but are you saved? Are you sure you will go to Heaven when you die? The reason some peopl May 24, 2005, 8:49 am
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you are, April 21, 2005, 1:25 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap