Hi, Sorry to take so long to reply. I don't know why I find this so confusing, but mostly I think I am just afraid of treating a connect handle like any other var. It was pretty cool in a way when my 6 or so connections got turned into one as soon as I started using Apache::DBI, but I am starting to have the occasional query fail because a connection doesn't exist. One thing I didn't expect is that I am making two connections, one to the local database, one to a remote host. I don't see any evidence that the remote host connection gets treated like it should with Apache::DBI. The remote host still shows lots of connections from me. So just to keep this on topic :) What would the party line be? If we are using CGI::Application and Apache::DBI what would be the recommenced way to keep a connection available. Maybe one that is inherited? It seems that would be simple to do, but I have some fear about it. Should every module I use from my CGI::Application module inherit the $dbh from it? Could I feel safe with that along eith Apache::DBI's pinging? Today, I am switching over my company to my new Customer Service system. That includes new web order forms and lots of this and that. I am pretty freaked, it is like 6000 lines of code, even with CGI::App and HTML::Template. The bigger this thing grows the more paranoid I get about making changes. Yet I still know the way I am doing the database connect with CGI::App is not great. On that note, I have to say CGI::Application and HTML::Templete have been a huge boon to us. We have a big website, with lots of affiliates, many different pages with different products and minor variations. And I am looking pretty good right now because thanks to you guys, I have been able to clean up a horror of misc Perl, PHP and even ASP scripts. What is even cooler, whenever I show this stuff to another perl guy. He gets blown away for a few minutes, basicly smacks his head, and says wow! that is so easy! Thanks, Eric At 10:15 AM 10/3/02 -0400, William McKee wrote: >Hi Eric, > >As I've demonstrated, I'm still trying to figure out these kinds of >questions. After this last incidence, my general approach is to remove all >globals. When it comes to mod_perl under Apache 1.3.x, I believe that a >global is global to all of your scripts. Apache 2.0 will eventually offer >the ability to run specific scripts in specific threads using the perchild >MPM <http://httpd.apache.org/docs-2.0/mod/perchild.html> which should help >limit the effect of globals. I think this is one reason it's almost >impossible to find cheap mod_perl shared hosting whereas mod_cgi and >mod_php are installed nearly everywhere. > >I'd be wary of using $dbh as a global because if you have two scripts >which set $dbh to different connection strings, it seems possible that App >1 could be processing a request when App 2 gets called and sets $dbh to a >different string. If App 1 then used the new $dbh setting, I'd think you'd >have problems. > >In my scripts, I set the $dbh as an attribute of my CGI::App module and >use Apache::DBI to do persistent database connections (or so I presume >since it does this transparently). So far, I haven't had any problems with >this arrangement even though the two apps that were interacting badly >earlier this week use two different databases. > >Perhaps someone smarter than us can comment on these mysteries. You could >also try PerlMonks.org if you don't get a satisfactory answer from the >mailing list. > >Good luck, >William http://www.kwinternet.com/eric (250) 655 - 9513 (PST Time Zone) "Inquiry is fatal to certainty." -- Will Durant --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/suppressed/ To unsubscribe, e-mail: suppressed For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.