[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] DBI /(Raise|Print)Error/ trick...
Interesting. I don't think I've used this trick before.
My program has DBI's RaiseError and PrintError on globally, but for this one SQL statement I really don't care if it works or not. (If it fails it'll work next time. No biggie.)
This is suggested in "perldoc DBI"...
{
local ($dbh->{RaiseError}, $dbh->{PrintError});
$dbh->do("delete from $test where property_id = 'TEST'");
}
I never use local, but here it seems pretty handy. { } is a new block, and local sets up a copy of those variables just for the scope of my { }. As soon as it exists that block, those variables go back to whatever they were before.
Pretty neat, huh?
j