... why not set the RaiseError attribute when connecting to the database.
Here, one reason not to do that is that you've got a custom dienice routine you want to call when database calls fail. Now, you *could* redirect errors by setting $SIG{__DIE__}, to point to your dienice routine, but as a couple of wise monks pointed out to me, that could wreak havoc if any modules you've imported contain dies in eval blocks.
There are two solutions that I can think of that recommend themselves: either keep RaiseError set to false and do all your error checking manually, calling dienice, OR wrap all your DB calls in eval blocks and call dienice with the contents of $@ if it is set (i.e. the standard Perl exception-handling mechanism).
HTH.
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
In reply to (arturo) Re: Script does not die when DB connection fails
by arturo
in thread Script does not die when DB connection fails
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |