Name
PrintError ( boolean, inherited)
Synopsis
This attribute can be used to force errors
to generate warnings (using warn
) in addition to
returning error codes in the normal way. When set “on,”
any method that results in an error occurring will cause the DBI to
effectively do a warn("$class
$method
failed:
$DBI::errstr")
where $class
is
the driver class, and $method
is the name of the
method which failed.
For example:
DBD::Oracle::db prepare failed: ... error text here ...
By default, DBI-
>connect
sets PrintError
to “on.”
If desired, the warnings can be caught and processed using a
$SIG{_ _WARN_ _}
handler or modules like
CGI::Carp
and CGI::ErrorWrap
.
Get Programming the Perl DBI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.