[cgiapp] cgiapp Digest, Vol 33, Issue 16

Nicholas Bamber nicholas at periapt.co.uk
Wed Jun 23 12:11:19 EDT 2010


Jerry,

Just focusing on this for a moment:

"Error executing class callback in prerun stage: must call dbh_config()
before calling dbh().

What this seems to mean is that $options{DBH} is undefined."


I assume you have had CGI::Application working with the standard DBH authentication driver. I am sure you have given previous conversations. If you have actually got DBH set up correctly then may be you could send me your code tarred up. 


> Message: 2
> Date: Wed, 23 Jun 2010 08:31:59 -0700 (PDT)
> From: "Jerry Kaidor" <jerry at tr2.com>
> Subject: [cgiapp] CAP::Authentication Multi-Driver
> To: "CGI Application" <cgiapp at lists.openlib.org>
> Message-ID:
> 	<61b4098ad54fc6d09e64363df827b6a4.squirrel at www.jm-properties.com>
> Content-Type: text/plain;charset=iso-8859-1
>
> Hello,
>
>    Continuing to try to get my multiple DBI's driver working.   As you may
> remember, I needed my application to know which database my user
> authenticated against.
>
>    With Nicholas Bamber's advice, I was off to a good start.  I created a
> driver ( MULTI_DBI.pm ) which subclasses the DBI driver using "use base".
>
>    My driver iterates through a hash of labels and dhb's, sending each dbh
> to the DBI driver.
>
>    Right now, after calling __SUPER__::verify_credentials with
>
>    $super_output = $self->SUPER::verify_credentials( $self, @creds );
>
> I get the following error:
>
> Error executing class callback in prerun stage: must call dbh_config()
> before calling dbh().
>
> What this seems to mean is that $options{DBH} is undefined.
>
> Using Data::Dumper -
> before calling the superclass:
>
>   dumper says $VAR1 = 'DBH';
>               $VAR2 = bless( {}, 'DBI::db' );
>               $VAR3 = 'DBHS';
>               $VAR4 = {'ST' => $VAR2,'IP' => bless({},'DBI::db' ),'GLOBAL'
> => bless( {}, 'DBI::db' ),'QR' => bless( {}, 'DBI::db' )};
>               $VAR5 = 'TABLE';
>               $VAR6 = 'users';
>
> ...The important part is $VAR1 and $VAR2, which together are a hash element
> defining "DBH" as some meaningful number ( that I got from the DBI library
> when opening the database ).  My MULTI_DBI driver added the DBH hash
> member
> so that the DBI driver would recognize it and verify against that database.
>
> HOWEVER, after calling the superclass I get:
>
> dumper says   $VAR1 = 'DBHS';
>               $VAR2 = { 'ST' => bless( {}, 'DBI::db' ), 'IP' => bless( {},
> 'DBI::db' ),'GLOBAL' => bless( {}, 'DBI::db' ),'QR' =>
> bless( {}, 'DBI::db' )};
>               $VAR3 = 'TABLE';
>               $VAR4 = 'users';
>
> ...Note that there are only 4 VARs.  And there is no DBH hash.  Apparently,
> Perl has kindly removed any changes that I made to the options hash/array.
>
>   One thought I had was that $self had somehow changed.  But no:
> (top of MULTI_DBI::verify_credentials )
> CGI::Application::Plugin::Authentication::Driver::MULTI_DBI=HASH(0x89be0a8)
>
> (top of DBI::verify_credentials
> CGI::Application::Plugin::Authentication::Driver::MULTI_DBI=HASH(0x89be0a8)
> ....looks like the same number to me....
>
>
>    Anybody know the magic to get new stuff to stick in $self->options?
> (Mostly fighting my own ignorance here, I know )
> Thanks in advance,
>
>                             - Jerry
>   


More information about the cgiapp mailing list