Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Question on CGI::Application::Plugin::DBH and named handles

by Anonymous Monk
on Aug 18, 2009 at 15:33 UTC ( [id://789500]=perlquestion: print w/replies, xml ) Need Help??

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

in CGI::App::Plugin::DBH + variable names I asked how to do this, the reply was to look at the documentation . I want to do
$dbh = $self->dbh($DBName);
but get an error as previously described, I can't see the module author using dbh_config().

Can someone tell me how this can be done? Named handels from a variable? Also is there some method like this for scripts that aren't CGI scripts, like command line scripts?

Replies are listed 'Best First'.
Re: Question on CGI::Application::Plugin::DBH and named handels
by Anonymous Monk on Aug 18, 2009 at 15:44 UTC
    must call dbh_config() before calling dbh().

    Means you must call dbh_config() before calling dbh(). There is no way other than to call dbh_config(), so why don't you call dbh_config()?

      I've done $dbh_config(); and $self->dbh_config(); which throw the error $dbh_config is not imported and for the secondmust call dbh_config. Thanks
Re: Question on CGI::Application::Plugin::DBH and named handles
by james2vegas (Chaplain) on Aug 18, 2009 at 19:53 UTC
    You shouldn't be using CGI::Application::Plugin::DBH outside of CGI applications, use DBI itself (or an ORM like DBIx::Class). Are you using CGI::Application? Are you calling dbh_config() in setup() or cgiapp_init()? If you are calling it in a run-mode then it won't be persisted into the run mode where you call dbh().
Re: Question on CGI::Application::Plugin::DBH and named handles
by markjugg (Curate) on Aug 18, 2009 at 17:27 UTC
    I have some inclination to help if only you'll give up the mask of anonymous monk.
      I thought you didn't need an account to post here? I really didn't want to cause any harm in asking for help. Thanks
        You don't need an account to post here. I just like to know who I am helping. You could at least sign a name in the comment, if not using an actual account. Since I wrote CGI::Application::Plugin::DBH, I thought I might be able to help.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-03-28 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found