in reply to DBI user input question

Any suggestions would be greatly appreciated

See http://perldoc.perl.org/perlintro.html#Conditional-and-looping-constructs especially http://perldoc.perl.org/perlintro.html#while

my $dbh; while( not $dbh ){ my $user = prompt("enter username"); my $pass = prompt("enter password"); $dbh = DBI->connect( $dsn, $user, $pass ); }

See also Term::Interact and Term::Interact example

Replies are listed 'Best First'.
Re^2: DBI user input question
by edimusrex (Monk) on May 15, 2012 at 12:40 UTC

    Still doesn't help me. What it does is disconnects and terminates the script upon error. Is there even a way to prompt the user to enter the credentials again without having to re-execute the program?

      Please show a short but complete program (with the user credentials elided!) that replicates the problem. Also show us the error message you get and the behaviour you expect. This helps us help you better, because we can then diagnose what error happens and maybe reproduce your situation.

      The DBI documentation says that ->connect returns undef on failure, so your error must be somewhere else.