Am Dienstag, 6. Juni 2006 13:22 schrieb Hartmaier Alexander: > Hi Gerald! > > Yes I know that! So can you tell me where to store my dbic schema object > which stores my dbh? >
I would do something like $dhic ||= DBIx::Whatever -> new (...) ; or $epapp -> {dbic} ||= DBIx::Whatever -> new (...) ; if you use the first one inside a embperl page, you should use another namespace, to make it globally available for all pages e.g.: $mydbic::dhic ||= DBIx::Whatever -> new (...) ; if you use the second one inside a custom module, you have to pass $epapp Gerald > -Alex > > > -----Original Message----- > > From: Gerald Richter [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, June 06, 2006 11:59 AM > > To: embperl@perl.apache.org > > Cc: Hartmaier Alexander > > Subject: Re: persistent DB connections > > > > Am Montag, 29. Mai 2006 11:05 schrieb Hartmaier Alexander: > > > If i use $epapp, where/when should I set it? Can it be done in my > > > > apache2 > > > > > config? (startup.pl) Same question for the global var... > > > > You should not open a db connection in startup.pl because handles will > > not be > > valid after the fork of the children. All other data can be setup in the > > startup.pl and stored in a global variable. > > > > The db connection should be opened at the first request to the db. > > > > Gerald > > > > > -Alex > > > > > > > -----Original Message----- > > > > From: Gerald Richter [mailto:[EMAIL PROTECTED] > > > > Sent: Monday, May 29, 2006 6:31 AM > > > > To: Hartmaier Alexander; embperl@perl.apache.org > > > > Subject: RE: persistent DB connections > > > > > > > > > I want to use my DBIx::Class module to access the db and want > > > > > to store a DBIx::Class::Schema object which holds a db > > > > > connection somewhere, so I can access it from my embperl > > > > > pages and my embperl library I include with > > > > > > > > > > Execute ({ inputfile => 'nacadminlib.epl', import => 1 }); > > > > > > > > > > in every page. > > > > > > > > > > I looked at the Embperl docs but couldn't find a solution. > > > > > > > > > > Put it in $epreq, or $epapp? > > > > > > > > > > How to do it to get one per apache2 child? > > > > > > > > Putting it in $epapp should work, but will get a db handle for every > > > > different name you specify with Embperl_App in your httpd.conf file. > > > > > > > > The other possibility is to put it in a global variable, then you > > > > will > > > > > > get a > > > > handle per Apache child > > > > > > > > Gerald > > > > > > > > > > > > > > > > ** Virus checked by BB-5000 Mailfilter ** > > > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*" > > *"* > > > > >"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien > > > Handelsgericht Wien, FN 79340b > > > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*" > > *"* > > > > >"* Notice: This e-mail contains information that is confidential and > > > > may be > > > > > privileged. If you are not the intended recipient, please notify the > > > > sender > > > > > and then delete this e-mail immediately. > > > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*" > > *"* > > > > >"* > > > > ** Virus checked by BB-5000 Mailfilter ** > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* >"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien > Handelsgericht Wien, FN 79340b > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* >"* Notice: This e-mail contains information that is confidential and may be > privileged. If you are not the intended recipient, please notify the sender > and then delete this e-mail immediately. > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* >"* ** Virus checked by BB-5000 Mailfilter ** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]