On Thu, 29 Jul 2004, Mark wrote:
> Question, though, how will you keep a persistent, say, MySQL connection in
> Perl, for the backend socketmap functionality?
Keep a global variable called $DBH. Write code like this:
# Put this at the top of your filter
undef $DBH;
sub get_dbh {
# Re-use if we already have one
return $DBH if defined($DBH);
# Get and cache a connection
$DBH = DBI->connect(....);
return $DBH;
}
Then in your filter routines, whenever you need the handle:
sub blah {
my $dbh = get_dbh();
# Now use dbh here...
}
--
David.
_______________________________________________
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang