thanks for answers. Not, I am not using Apache::DBI. Also my mod_perl scripts has strange behaviors, for example:
..
die "a";
..
die "b";
...
sometimes script dies on die "a" (always should!), and sometimes on die "b". I really dont know whats going on here
UPDATE: It seems to be caching issue. I have to turn this off while developing, where set this plz ? | [reply] [d/l] |
It's not exactly a caching issue. Your global variable stays around, since you are running in a persistent environment. After some inactivity, the database disconnects the idle connection. Then your next attempt to use that connection fails. Apache::DBI will fix this for you. You just need to call DBI->connect every time instead of only the first time when your "use lib" is executed. Make that library into a proper Perl5 module with a package declaration, and add a sub to it that makes the DBI->connect call and returns the handle. Apache::DBI will handle caching that connection so that it doesn't have to reconnect if the handle is still active.
| [reply] |