in reply to DBI timeout

don't know if there's a built in time out for DBI or not, but you could try using alarm.
$SIG{'ALRM'} = sub { print "Time's up\n"; }; # give it 15 seconds alarm(15); # dbi calls # turn the alarm off alarm(0);

/\/\averick

Replies are listed 'Best First'.
RE: Re: DBI timeout
by eduardo (Curate) on Jul 20, 2000 at 22:06 UTC
    gee maverick... our answers are so similar... it's like we know each other, worked next to each other for 8 months, live 3 minutes down the road from each other, and hang out damned near on a daily basis or something! :) now, my question to you about your response... how would you use the alarm going off here to get out of the DBI call going bad... you didn't encase it in a block or anything like that. also, i heard somewhere that it was good to reset alarm handlers at the end of themselves for some reason... can anyone back that up, or is that one of those things i immagined?

    update: ok, just out of curiosity... why was this voted down? i mean, no biggie if someone didn't like me having a conversation with mav, that's fine... but i can't understand why this was voted down...

      who are you? what are you talking about?

      Ya, your solution is better. 'course I pulled this out of my head in about 3 seconds, I didn't rogue it from a perldoc page :) Depending on how I wanted to handle the timeout, I would have probably ended up with an eval block anyways.

      /\/\averick

RE: Re: DBI timeout
by Cirollo (Friar) on Jul 20, 2000 at 22:08 UTC
    Thanks, thats exactly what I needed. Plus, I can use the subroutine to print a nice error message in the HTML output.