develooper Front page | | Postings from January 2019

Re: RaiseWarn attribute for DBI

Thread Previous | Thread Next
Alexander Hartmaier
January 17, 2019 09:40
Re: RaiseWarn attribute for DBI
Message ID:
I don't see the benefit, Print* should die and I'd personally would release a major release and change the defaults as a breaking change: PrintError false, RaiseError true.
Can you name a use case and how to differ between an error and a warning at the error handling side?

Best regards, Alex

On 2019-01-17 10:04, wrote:
> Hello! What do you think about adding a new attribute $dbh->{RaiseWarn} which cause that warnings reported by DBI drivers would behave like errors? For errors DBI has there $dbh->{PrintError} and $dbh->{RaiseError} attributes. First one is by default true and second one by default false. When PrintWarn is true, then all error from DBI driver are passed to perl's "warn" function and when RaiseError is true, then errors are passed to perl's "die" function. (Plus there is ability to register own error handler function) Currently DBI has only $dbh->{PrintWarn} attribute to control warnings. When is set to true (by default) all warnings from DBI driver are passed to perl's "warn" function. So I would propose to add $dbh->{RaiseWarn} attribute (off by default) to behave like $dbh->{RaiseError}, but for warnings. I have implemented this attribute and patch is there: 

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About