From 9d53f9972028b77038053da28e90deed223d5908 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 23 Sep 2007 15:28:07 +0000 Subject: * added readPassword() to Utils.pm, a function which fetches a password from the terminal (via readline). git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1342 95ad53e4-c205-0410-b2fa-d234c58c8868 --- lib/OpenSLX/Utils.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index 86c31ca9..57ca8040 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -32,6 +32,7 @@ $VERSION = 1.01; chrootInto mergeHash getFQDN + readPassword ); ################################################################################ @@ -276,4 +277,16 @@ sub getFQDN return $FQDN; } +sub readPassword +{ + my $prompt = shift; + + use Term::ReadLine; + my $term = Term::ReadLine->new('slx'); + my $attribs = $term->Attribs; + $attribs->{redisplay_function} = $attribs->{shadow_redisplay}; + return $term->readline($prompt); + +} + 1; -- cgit v1.2.3-55-g7522