"James Array" <[EMAIL PROTECTED]> wrote:
>Haloo
>
>          I'm confusing of how to port DBI CGI to Apache::DBI mod_perl with 
>Apache::Registry
>for the most efficient:
>
>if my normal DBI CGI is:
>
>use strict;
>use DBI;
>
>my $dbh=DBI->connect("database","login","password","mysql");
>......
>$dbh->disconnect;
>
>=========================================================
>
>when port to Apache::DBI should I modify it as
>1:
>
>use strict;
>use DBI;
>use vars qw($dbh);
>
>$dbh=DBI->connect("database","login","password","mysql");
>........
>$dbh->disconnect;
>

This would be a good try.  If Apache::DBI is loaded first, it will cache 
connections and create a new one only if there isn't an existing connection 
for the particular combination of connection arguments.  More details should 
available in the Apache::DBI perldoc.

You definitely want to go with a `use vars' for $dbh if it can't be localized 
to a subroutine.  But then, I haven't done Apache::Registry scripts for so 
long, I can't remember for sure (most of my code now is modules).  You might 
want to check out the mod_perl Guide on that one.
-- 
James Smith <[EMAIL PROTECTED]>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix


Reply via email to