Thread: HELP!Animation with perl
Results 1 to 3 of 3
Related
-
CSS 3.0 animation features Forum: CSS Forum
Replies: 0 -
basic animation Forum: Javascript Forum
Replies: 1 -
problems with animation Forum: Graphics Forum
Replies: 1 -
Animation problem Forum: Graphics Forum
Replies: 1
-
09-02-2005, 09:07 AM #1
HELP!Animation with perl
Hi!
How to implement animation in perl in commnad line.
I need to view strings in one line only, not in new lines, and with some delay. I tried \r with sleep function but it didn't help. It seems that sleep function works only with \n.
so
print "hello1\n";
sleep 1;
print "hello2\n";
works, but
print "hello1\r";
sleep 1;
print "hello1\r";
don't.
-
09-03-2005, 09:54 AM #2
Re: HELP!Animation with perl
if i understand what you are trying to do, the best bet is to use javascript, but you may use perl to put javascript in it, try this:
Code:#!usr/bin/perl print "Content-type:text/html\n\n"; print '<html> <head> <script type="text/javascript"> function timer(t){ document.getElementById("timer").innerHTML = "Count to 10: " + t + " of 10"; } </script> </head> <body> <div id="timer"> </div>'; for ($i = 1; $i <= 10; $i++) { print "<img src=\"\" onerror=\"timer($i); this.outerHTML = ''\">"; sleep 1; } print '</body></html>';
-
09-05-2005, 05:22 AM #3
Re: HELP!Animation with perl
When you say command line, I presume this is non-CGI, right?
Try the (http://search.cpan.org/~jstowe/Term-Screen-1.03/Screen.pm) Term::Screen module, in particular the clreol() method.
From the docs: Clear to the end of the line - cursor doesn't move.
Also of use might be the (http://search.cpan.org/~kbaucom/Term-Animation-2.1/lib/Term/Animation.pm) Term::Animatiom module.
See also (http://search.cpan.org/~jhi/Time-HiRes-1.73/HiRes.pm) Time::HiRes for sleeping less than a whole second.Last edited by HTML; 03-09-2012 at 10:18 AM.
[Hostdens] – Cheap Linux Cloud VPS | Cheap Windows VPS...
10-23-2019, 05:25 AM in Web Hosting Forum