Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 surveying the Monastery: (4)
As of 2015-07-03 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls