Created
October 6, 2010 09:29
-
-
Save ysasaki/613078 to your computer and use it in GitHub Desktop.
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 | |
# Usage: read-password.pl --user hoge -p | |
use strict; | |
use warnings; | |
use Term::ReadPassword; | |
use Data::Dumper; | |
use Getopt::Long; | |
my %options; | |
my $ret = GetOptions( \%options, 'user|u=s', 'password|p', ); | |
if ( $options{password} ) { | |
RETRY: { | |
my $password = read_password('New password: '); | |
my $confirm = read_password('Re-type new password: '); | |
if ( $password eq $confirm ) { | |
$options{password} = $password; | |
} | |
else { | |
goto RETRY; | |
} | |
} | |
} | |
print Dumper(\%options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment