in reply to Confusion about properly using Carp

The backtrace is created by Carp's croak() or carp() (croak with RaiseError, carp with PrintError).
You can override Carp's functions in the DBI namespace as follows:
*DBI::croak = sub { ... };

Lbh ebgngrq guvf grkg naq abj lbh pna ernq vg. Fb jung? :) -- Whreq

Replies are listed 'Best First'.
Re: Re: Confusion about properly using Carp
by koolade (Pilgrim) on Mar 02, 2002 at 17:06 UTC
    He's calling carp() from Foo.pm, not DBI.pm, so this won't accomplish what he's asking.
      I was thinking along the lines of: (warning: untested code ahead)
      package Foo; ... our $error; *DBI::carp = sub { $Foo::error = shift }; ... my $self->{dbh} = DBI->connect( ... ) or carp $error;

      Lbh ebgngrq guvf grkg naq abj lbh pna ernq vg. Fb jung? :) -- Whreq