Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

CGI::App::Plugin::DBH + variable names

by Anonymous Monk
on Aug 11, 2009 at 09:10 UTC ( [id://787538]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

In Cgiapp_init I have several DBs defined like
$self->dbh_config('Server1', [ $self->cfg('dsn'), $self->cfg('dbuser'), $self->cfg('dbpass') ] );
when I try
$dbh = $self->dbh($dbName);
where $dbName is 'Server1', it shows the error
must call dbh_config() before calling dbh().
How can I use a variable here to determine databases?

Replies are listed 'Best First'.
Re: CGI::App::Plugin::DBH + variable names
by Anonymous Monk on Aug 11, 2009 at 09:29 UTC
    Call dbh_config()?
      but when I used
      <c>$dbh = $self->dbh('Server1') if ( uc($dbName) eq 'Server1' );<c>
      It works, I don't see the docs use dbh_config in the examples for this.
        ??

        1. Module is CGI::Application::Plugin::DBH , not CGI::App::Plugin::DBH
        2. It works, I don't see the docs use dbh_config in the examples for this.

          Look at CGI::Application::Plugin::DBH

        That code 'works' in that it doesn't do anything since uc($dbName) eq 'Server1' is always false.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://787538]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-19 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found