Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I get the error:sub cgiapp_init { my $self = shift; # Configure Database handler for the entire app $ENV{'ORACLE_HOME'} = $self->cfg('OracleHome'); $self->dbh_config('db1', [ $self->cfg('db1dsn'), $self->cfg('db1dbus +er'), $self->cfg('db1pass') ] ); $self->dbh_config('db2', [ $self->cfg('db2dsn'), $self->cfg('db2li +vusr'), $self->cfg('db2pass') ] ); } sub Login { my $self = shift; my $q = $self->query(); my $strSQL = 'SELECT FOO, BAR FROM TABLE WHERE Foo = ?'; my $dbh = $self->dbh->('db1'); my $sth = $dbh->prepare($strSQL) or die "Can't prepair stateme +nt: $self->DBI::errstr"; $sth->execute($baz); ....
I've read the Docs and think I'm doing it right, I don't know how to debug this. Can anyone give an example of using CGI::App like this, with multiple DBs,or show what is wrong in my example?Error executing run mode 'Login': must call dbh_config() before callin +g dbh().
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI:APP::Plugin::DBH + Multiple DBs
by scorpio17 (Canon) on Aug 01, 2009 at 14:34 UTC |