Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Abstracting Class::DBI Database Connection Data

by gryphon (Abbot)
on Jun 08, 2004 at 22:44 UTC ( [id://362584]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Abstracting Class::DBI Database Connection Data
in thread Abstracting Class::DBI Database Connection Data

Maybe someone with a little more knowledge on this than I can provide a working example?

Yes, exactly. I think I get what I need to do, but I most certainly don't have a clue how to do it. If anyone has some working code they'd be willing to share, I would be very grateful.

gryphon
code('Perl') || die;

  • Comment on Re^4: Abstracting Class::DBI Database Connection Data

Replies are listed 'Best First'.
Re^5: Abstracting Class::DBI Database Connection Data
by perrin (Chancellor) on Jun 09, 2004 at 00:16 UTC
    sub db_Main { Ima::DBI->connect_cached(@conn_info); }

      Can't locate object method "connect_cached" via package "Ima::DBI" at MyCDBI.pm line 4.

      gryphon
      code('Perl') || die;

        Sorry, that was a copy/paste from the mailing list. You can just call DBI->connect_cached(), but you have to set some other things that are described on the mailing list. That's the best place to look for this info.

        However, I think you're making it too hard. The only thing wrong with what you have is that you are passing data around by serializing it and sticking it in %ENV. Why not just make your $cfg object available from other classes? Stash it in a global and then make a simple accessor like MyCfg::get_cfg() that MyCDBI can call to get it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found