Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am currently trying to create a prompt for a perl script to have the user enter their MySQL username and password before executing the code. That part is easy enough but what I want it to do is loop if the DBI returns an accessed denied error thus asking the user to reinput the information. Any suggestions would be greatly appreciated. Here is the begging part of the code
my $database = ""; my $platform = "mysql"; my $host = "5.214.214.121"; my $port = "3306"; print "Enter User Name\n"; my $user = <>; chomp $user; print "Enter Password\n"; my $pw = <>; chomp $pw; $dsn = "dbi:mysql:$database:5.214.214.121:3306"; $dbh = DBI->connect($dsn, $user, $pw, { RaiseError => 0, Print +Error => 1 });
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI user input question
by Anonymous Monk on May 14, 2012 at 20:00 UTC | |
by edimusrex (Monk) on May 15, 2012 at 12:40 UTC | |
by Corion (Patriarch) on May 15, 2012 at 13:03 UTC |