Last active
August 31, 2017 13:49
-
-
Save v4p0r/6c9d197d1fe67531130cde2c482fdb78 to your computer and use it in GitHub Desktop.
exemple progressbar in perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Exemplo de progressbar by v4p0r | |
# Ajuda em http://www.perlmonks.org/?node_id=980562 | |
# Data: 31/AGO/2017 | |
# Horas: 02:12 | |
use strict; | |
use warnings; | |
use utf8; | |
sub banner { | |
print "["; | |
print "ProgressBar em perl"; | |
print "]\n"; | |
} | |
my $n = "1"; # Número que começa os "::" | |
my $e = "30"; # Número que termina os "::" | |
my $v = "0.30"; # Velocidade que os "::" vão percorrer | |
sub tempo { | |
my ($segundos,$minutos,$hora) = localtime(); | |
print "["; | |
print "$hora:$minutos:$segundos"; | |
print "] "; | |
} | |
sub progressbar { | |
$| = 1; | |
binmode STDOUT, ":utf8"; | |
print "[!] "; | |
tempo(); | |
my $d = "::"; # Caracter que ira decorrer | |
for ($n..$e) { | |
select(undef, undef, undef, $v); | |
print "$d"; | |
} | |
print"\n"; | |
} | |
banner(); | |
progressbar(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment