Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

A stupid sdtio problem

by E-Bitch (Pilgrim)
on Jun 13, 2001 at 03:42 UTC ( [id://87964]=perlquestion: print w/replies, xml ) Need Help??

E-Bitch has asked for the wisdom of the Perl Monks concerning the following question:

Okay, now I know this seems pointless, but humor me. I have seen several command line utilities do this, and I know it can be done. That being said, what I want to accomplish is during the execution of a program ( a file processing program meant to parse through about 28000 files (about 300,000 lines), to be more specific), I would like to show the user that the program is doing something. I have tried printing and endless stream of '.'s out about every 1000 lines or so, but that fills up the damned terminal window... so what I want to do is display the following characters, so they overlap eachother (giving the optical illusion of rotation): | \ - / If this is done correctly, the pipe will be displayed, followed by the backslash overtop of it, then the dash, then the forward slash, and all of this without disturbing what is already on the screen... so any takers out there?

Replies are listed 'Best First'.
Re: A stupid sdtio problem
by bikeNomad (Priest) on Jun 13, 2001 at 04:06 UTC
    You can use the "\r" character to return to the first column. Or the "\b" character to backspace:
    $|++; # unbuffer STDOUT my @chars = qw(| \ - /); my $lastChar = 0; sub stick { my $msg = shift; $lastChar = ++$lastChar % 4; print "\r$msg", $chars[ $lastChar ]; } for (1..10000) { stick("Testing: "); select(undef, undef, undef, 0.1); }
Re: A stupid sdtio problem
by ZZamboni (Curate) on Jun 13, 2001 at 05:59 UTC
    See this thread for several good ideas on how to do this.

    Also, it might help in the future to use a more descriptive title for your nodes.


A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://87964]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-15 14:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found