Nighthawk wrote on 20.05.2008 18:33:
I am trying to write plugin that does DB lookup and want to use the same
db connection in more than 1 plugins.
Somwhere I read that we can save DB connection in qp->config(). But it
is not working in my case.

Please have a look at my db/suite
http://dienstleistung-kultur.de/qpsmtpd/
for a concrete implementation of a DBI connection stored in
$qp->connection->notes()

(MEMO to self: check this out with the TLS-problem...)

On
http://dienstleistung-kultur.de/qpsmtpd/db_common.shtml#inheritance
you'll find a skeleton for an own plugin inheriting from db/common,
which provides all the database handling stuff.

Just say in /etc/qpsmtpd/plugins

        db/base
        db/your_plugin

and in db/your_plugin you can easily access your database defined in
/etc/qpsmtpd/db_base via the methods provided by db/common.

See also the discussion at
http://www.nntp.perl.org/group/perl.qpsmtpd/2007/08/msg7144.html

Ernesto




Reply via email to