Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Confusion about properly using Carp

by Juerd (Abbot)
on Mar 02, 2002 at 16:55 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found