On 15 Oct 2008, at 14:25, Brandi wrote:

2)

I have some computation that might cause the connection to MySQL to
timeout.  How can I reestablish a connection in my script, or in other
words disconnect and reconnect again at a later time in my script?


Default timeout is 30s, and having a web request sit for 30s is bad form. But anyway:

use $schema->txn_do(sub {
    # Code goes here
});

If the connection times out at anypoint during that, the entire thing will be restarted and rexecuted. I wouldn't bother with explicitly disconnecting.

http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Schema.pm#txn_do

-ash

_______________________________________________
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