loading/processing animation in perl

Is there a way to display an animation while Perl is processing a file or something else? Maybe the sequence of | / - | \ (rotating pipe) instead of just printing dots.

Thanks for your help.

Answers


The simple rotating pipe can be created using code like this:

#!/usr/bin/perl

use strict;
use warnings;

$|++; # turn off output buffering;

my @chars = qw(| / - \ );

my $i = 0;

print $chars[$i];

while (1) {
  sleep 1;
  print "\b", $chars[++$i % @chars];
}

For something more complex, take a look at Term::ProgressBar.


Need Your Help

DataFormatString rounding decimal to larger value

c# asp.net .net decimal rounding

DataFormatString="{0:F2}" in my ascx page for value 0.0001 results in "0.00" and what I need is "0.01", that is rounding away from zero. Is it possible to achieve in asp.net with DataFormatString or

Prevent download file from extra tags

asp.net

I write small WebApp on ASP.NET, where I can upload files(data is stored in SQL FILESTREAM) and get it back. But, when I compare primary and download file in text editor there is difference. Extra ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.