Ask a Question related to PERL Beginners, Design and Development.
-
Paul Harwood #1
Using print to overwrite a line
Is there a simple way to print over an existing line?
For example: I would like to have a progress report that reads 10%, 20%
etc. I don't want to print a new line each time. I want to write over
the existing line and have it update as it goes.
--Paul
Paul Harwood Guest
-
To print a document from command line
I want to invoke the print dialog of acrobat from command line. I can easily do this using '/p' argument in Windows. But how to do this on a MAC?? -
In-line graphics won't print
Greetings, I'm using a small graphic as the bullet for a bulleted list. The bullets display properly within FreeHand. However, if I print it (or... -
Windows Print PDF from Command Line
Franke, I have a problem some thing like this one. I need to have my user be able to print using adobe printer. I tried the above and it does only on... -
'print' output on one line
I have a perl program ( with DBI ) which prints out a line to STDOUT after every 100 database commits. I would like the 'print' to just refresh... -
printer in jetdirect only print one line...
I use /opt/hpnpl/bin/addqueue command to create a printer queue in Solaris, but when I issue lp -d printer1 eagle , I only get one line printed... -
Bob Showalter #2
RE: Using print to overwrite a line
Paul Harwood wrote:
Use "\r" to move to the beginning of the current line (depending on the> Is there a simple way to print over an existing line?
>
> For example: I would like to have a progress report that
> reads 10%, 20%
> etc. I don't want to print a new line each time. I want to write over
> the existing line and have it update as it goes.
>
> --Paul
capabilities of your terminal). Also unbuffer STDOUT. Something like this:
$| = 1;
for (1 .. 5) {
print "\rStep $_";
sleep 1;
}
print "\rFinished.\n";
Bob Showalter Guest
-
Rob Dixon #3
Re: Using print to overwrite a line
Paul Harwood wrote:
Hi Paul.>
> Is there a simple way to print over an existing line?
>
> For example: I would like to have a progress report that reads 10%, 20%
> etc. I don't want to print a new line each time. I want to write over
> the existing line and have it update as it goes.
I presume you're writing to a file? Can you show us an example of what
you mean? It's probably best if you rewrite the file, but that's not
a problem.
Rob
Rob Dixon Guest
-
Hacksaw #4
Re: Using print to overwrite a line
This is not the most elegant solution, but it did only take me five minutes.
The salient part is the backspace and printing blanks bit. A more elegent
solution would figure out how to destructively clear the line using something
from ncurses.
#!/usr/bin/perl -w
$|=1;
@reports = ("starting", "now we're cooking", "Almost half!", "Over the hump",
"Almost done!", "Finito!");
#print @reports;
foreach $item (@reports)
{
print $item;
sleep 1;
print "\b" x length($item);
print ' ' x length($item);
print "\b" x length($item);
}
--
Music so wishes to be heard that it calls on some to give it voice and some to
give it ears.
[url]http://www.hacksaw.org[/url] -- [url]http://www.privatecircus.com[/url] -- KB1FVD
Hacksaw Guest
-
Flimm #5
Re: Using print to overwrite a line
This doesn't work if the line being printed is longer than the width of the terminal.
Flimm Guest



Reply With Quote

