in reply to Perl dbi disconnect question...
First you have to answer the question "what do i want to have happend when an error occurs during X?" Then you can decide where to do what.
Regarding your connection line:
make sure that you set RaiseError to true and you could even 'attach' your bail_out sub as well:$dbh->connect(assuming_relevant_connection_params_are_here);
Now, when an error occurs, your sub will called automatically. Give that a shot and see what happens.my $dbh = DBI->connect( 'DBI:driver:database:host', 'user', 'pass', {RaiseError => 1, HandleError => \&bail_out}, );
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl dbi disconnect question...
by kiat (Vicar) on Jan 05, 2004 at 01:17 UTC | |
by jeffa (Bishop) on Jan 05, 2004 at 15:55 UTC |