in reply to Re: Ignoring/Trapping the DIE signal
in thread Ignoring/Trapping the DIE signal
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ignoring/Trapping the DIE signal
by chrism01 (Friar) on Jun 15, 2006 at 05:42 UTC | |
Didn't quite understand the DB def for 'value' being empty in example, but tried it anyway, got 'DBD::mysql::st execute failed: No database selected' at each execute, so tried filling in with real values as above, and got same errors as in orig post, ending with 'Can't call method "quote" on an undefined value at ./pd.pl line 83', then perl died. | [reply] [d/l] |
by McDarren (Abbot) on Jun 15, 2006 at 16:54 UTC | |
Anyway, I just went digging through my old code to find an example of what I'd used. Basically, I used a very simplified version of the above - something like this:
Then what I did was call check_db_connection before each database transaction. Is this the best way to do it? (I doubt it) But.... it worked fine for me for several months :) Cheers, | [reply] [d/l] [select] |
by chrism01 (Friar) on Jun 15, 2006 at 23:45 UTC | |
(Thx for looking that up for me anyway) All the variations I've tried so far enable you to trap an error and do some(!) extra processing, then die/exit. The prob I'm getting is that if you want to continue anyway, which I do, it's pretty consistent (see my results) that after approx 3 DB related errors, Perl dies regardless, even if you use a SIG{__DIE_} trap! :-( If you know how to do what I want, I'll owe you big time... Don't suppose you know how I could get someone like Merlyn or some other Perl internals guy to look at this? I feel it ought to be possible. As background, the system is setup such that MySQL will (eventually) re-start, but I want my progs to survive till then, not die/restart as well. | [reply] |