On 15 Oct 2008, at 15:36, Brandi wrote:

Ash,
I really don't understand -- so this is so the interaction with the DB
code takes more than 30 sec...  But what about if I am doing some
interaction with the database then my code has to run a process that
doesn't do anything with the database, then I have to do something
with the database.

if it were DBI,
I would:
my $dbh =  DBI->connect("dbi:mysql:db=database",
                       $user,$pwd) or die $DBI::errstr;

#do stuff -- interact with the database

$dbh->disconnect;

#do stuff like run a external program to calculate stuff

my $dbh =  DBI->connect("dbi:mysql:db=database",
                       $user,$pwd) or die $DBI::errstr;


#do stuff to interact with database.


How do I do that??

BTW -- this is not through the web.


> I am using DBIx::Class to run a CGI interface

...... what? Is it CGI or isn't it?

If you really want to do it exactly like that, make sure that the schema object and all rows that come from it go out of scope. Or dont worry about doing a disconnect, and just do the second block inside a txn_do call - that will reconnect as needed if the connection has timed out.


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to