projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed conf
[clearscm.git]
/
lib
/
Utils.pm
diff --git
a/lib/Utils.pm
b/lib/Utils.pm
index
f52fe4b
..
446d2e7
100644
(file)
--- a/
lib/Utils.pm
+++ b/
lib/Utils.pm
@@
-341,10
+341,9
@@
Returns:
=cut
=cut
-
$prompt ||= 'Password';
$prompt ||= 'Password';
- my $password;
+ my $password
= ''
;
local $| = 1;
local $| = 1;
@@
-357,7
+356,7
@@
Returns:
while () {
my $key;
while () {
my $key;
- while (not defined ($key = ReadKey -1)) { }
+
while (not defined ($key = ReadKey -1)) { }
if ($key =~ /(\r|\n)/) {
print "\n";
if ($key =~ /(\r|\n)/) {
print "\n";
@@
-365,9
+364,18
@@
Returns:
last;
} # if
last;
} # if
- print '*';
+ # Handle backspaces
+ if ($key eq chr(127)) {
+ unless ($password eq '') {
+ chop $password;
+
+ print "\b \b";
+ } # unless
+ } else {
+ print '*';
- $password .= $key;
+ $password .= $key;
+ } # if
} # while
ReadMode 'restore'; # Reset tty mode before exiting.
} # while
ReadMode 'restore'; # Reset tty mode before exiting.
@@
-463,7
+471,7
@@
In a scalar context just the 1 minute load average.
# TODO: Make it work on Windows...
return if $^O =~ /win/i;
# TODO: Make it work on Windows...
return if $^O =~ /win/i;
- open my $loadAvg, '/proc/loadavg'
+ open my $loadAvg, '
<', '
/proc/loadavg'
or croak "Unable to open /proc/loadavg\n";
my $load = <$loadAvg>;
or croak "Unable to open /proc/loadavg\n";
my $load = <$loadAvg>;