... or you'll never know if the DB is connecting
Technically speaking, well yes, you could know if the DB is connecting without causing the script to die. If connect() fails, a warning via STDERR is emitted but your script still runs. By specifying {RaiseError => 1}, DBI will, by default, "throw" a die for you, but you can still see why the connect failed without having to explicitly or die $DBI::errstr or use {RaiseError => 1}.
Finally, telling a "newbie" to go back and add error checking usually results in statements like "I just want to get it to work." That's why i recommend {RaiseError => 1} up front, you only need to add one line of code for error checking across the board. I'm just nitpicking Dave ... you and your point for some error checking are gold. :)
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)
In reply to Re^4: DBI selectall_arrayref
by jeffa
in thread DBI selectall_arrayref
by THuG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |