Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Inheriting from DBI

by janDD (Acolyte)
on Mar 02, 2011 at 18:50 UTC ( #891068=note: print w/ replies, xml ) Need Help??

in reply to Re: Inheriting from DBI
in thread Inheriting from DBI

Well, the reason I am trying to do that is because I have to connect often to a database which is not very reliable in the sense that only one our of five connections is successful. So I want to enhance the connect, prepare, ... statements with some errorhandling (trying to reconnect several times, writing an error message by mails etc..) I am doing this now with simple functions, but I thought, a class is more appropriate ... J.

Comment on Re^2: Inheriting from DBI
Replies are listed 'Best First'.
Re^3: Inheriting from DBI
by jeffa (Bishop) on Mar 02, 2011 at 19:07 UTC
Re^3: Inheriting from DBI
by runrig (Abbot) on Mar 03, 2011 at 15:52 UTC
    Your class doesn't need to inherit from DBI, it just needs to return a database handle. I've written lots of wrappers that connect to some default database in some default way that goes something like:
    package MyDBI; use DBI; sub connect { ...get args my $dbh; stuff $dbh = DBI->connect(...); more stuff return $dbh; }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2016-02-06 08:12 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (219 votes), past polls