1 package CXGN
::Tools
::Terminal
;
5 =head1 CXGN::Tools::Terminal
7 Little utilities for terminal-based scripts
11 use base qw
/Exporter/;
14 our @EXPORT_OK = qw
/ get_userpass
22 print "\nEnter username: ";
23 my $username = <STDIN
>;
25 print "Enter password: ";
27 my $password = <STDIN
>;
31 return ($username, $password);
36 my ($count, $max) = @_;
37 return unless($count && $max); #count=0 returns immediately, count = 1 starts it off
38 if($count==1){ print "\nProgress:||"}
39 my $step_size = int($max / 8) - 1;
40 if($count==$step_size) { print "===12%"; }
41 elsif($count==2*$step_size) { print "===25%";}
42 elsif($count==3*$step_size) { print "===37%";}
43 elsif($count==4*$step_size) { print "===50%";}
44 elsif($count==5*$step_size) { print "===62%";}
45 elsif($count==6*$step_size) { print "===75%";}
46 elsif($count==7*$step_size) { print "===88%";}
47 elsif($count==8*$step_size) { print "===100%\n";}
54 $message .= "," unless $message =~ /\.$/;
56 print " Continue? [y/n]: ";
58 return 1 unless $r =~ /^n/i;