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

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
Re^3: Inheriting from DBI
by jeffa (Chancellor) 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; ...do stuff $dbh = DBI->connect(...); ...do more stuff return $dbh; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-04-21 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls