I have a CGI application where I do:

require 'db.pl';

where db.pl defines some functions and variables related to connecting to
the database, and then executes C<$dbh = DBI->connect(...)>.

I tried to convert this application to modperl, but I ran into the problem
that require did not execute db.pl again the second time I called the
script, so that the C<$dbh = DBI->connect(...)> line was not executed.

I can get around this by changing C<require> to C<do>, but is that the
"correct" way of doing things? It seems a waste to redefine all the
subroutines and variables again. But I do need it to reinitialize $dbh
when C<require 'db.pl';> is called.

What should I do?

Reply via email to