Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Confusion about properly using Carp

by Juerd (Abbot)
on Mar 02, 2002 at 16:55 UTC ( #148839=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://148839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-10-02 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (12 votes). Check out past polls.

    Notices?