Bas Schulte wrote:
Jim,
On donderdag, maa 31, 2005, at 21:06 Europe/Amsterdam, Jim wrote:
If you feel like giving me an example that accomplishes what I want to do
below, I'd be glad to use yours too. :-)
The concept is fairly simple: instead of connecting to your database in
your 'client_input' state, push the input data at the end of a global list:
[snip]
You might just as well open the db connection when your tick session
starts, and hold a reference to it in the heap of that session. Then
you'd have to be prepared for the connection getting lost, and reconnect
when it is lost.
How about using DBI->connect_cached(...) ?
I'm a frequent user of Class::DBI, which does persistent connections and on-the-fly reconnecting. I use it in combination with POE a lot,
and never have to worry about it. I suppose a simple base class would be enough:
package My::Dbh;
use base qw/Class::DBI/;
My::Dbh->set_db('Main', 'dbi:mysql:test', 'login', 'password');
1;
Now just use
my $dbh = My::Dbh->db_Main;
for your database handle.
my $0.02 (well, NOK0.02 really)
Rhesa
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|