Re: global data .....
[prev]
[thread]
[next]
[Date index for 2005/01/29]
On Sat, 2005-01-29 at 00:19 +0200, raptor wrote:
> my mstake i tried with "our" too..
If you do that, you should be able to access it later, provided you use
the full package name.
> U mean closing the connection created by this snippet.. just after I execute it ?
> Browsed the code can't see how to access the dbh !! so that i can close it.
You can access it by calling My::Stuff->db_Main().
> If I try to use created classes later, will they open their own connections ?
Yes.
> Now I see I can try to do Loader-stuff in httpd.conf <Perl></Perl>, if I do it will classes
> stay for all childrens ?
That's not a good place to do this. Your startup.pl script, or whatever
Apache::ASP thing is equivalent is better. You need to make sure you
put it in a package so you know where it is when my need it again:
$My::Stuff::loader = Class::DBI::Loader->new(...
> The Apache::DBI is doing well behind the scenes i.e. caching connetions, isn't it ?
> or I dont need it 'cause Class::DBI uses Ima::DBI ?
Ima::DBI will call connect_cached, which actually uses Apache::DBI when
Apache::DBI is loaded. This can be a problem, because Apache::DBI won't
let you call disconnect(). If you are not using transactions inyour
database, I'd suggest you just avoid Apache::DBI and let connect_cached
take care of the persistence instead. Otherwise, you will have to do
some additional work to make Apache::DBI gets skipped during startup.
- Perrin
|
(message missing)
|