in reply to How to subclass DBI and still have the errors reported in user code

As you see the error is reported to occur on line 15 (inside MyDBI::db::selectrow_array), but I want it to be reported on line 38 (where selectrow_array is called).
Adapting DBI.pm's discussion of error handling, you might try:
use Carp; DBI->connect(..., { RootClass => ..., HandleError => sub { local $Carp::CarpLevel = 1; $_[0] = Carp::shortmess($_[0]); 0; }, }

Your subclass' connected method might install something like this by default, taking care to remember and summon a user-supplied HandleError, too.

-pilcrow
  • Comment on Re: How to subclass DBI and still have the errors reported in user code
  • Download Code