[cgiapp] CAP::Authentication Multi-Driver
Jerry Kaidor
jerry at tr2.com
Wed Jun 23 11:31:59 EDT 2010
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