Eric B wrote:
> 
> I have been using eperl until recently, but found Apache::ASP provides
> useful session features that I like.  Also, I am experienced with ASP.  I
> installed Apache::ASP and it seems to operate quite nicely most of the time.
> 
> However, there is some odd caching or some kind of saving going on because I
> get the error "MySQL server has gone away" (in the error_log of that site).
> My dbh routines are contained in a file subs.pl which I require "subs.pl"
> from the main script, manage.phtml.  If I don't use subs and include files I
> will working on this until I'm about a billion years old.
> 

With a setup like this, there will be some very odd caching very likely.
I don't know what your subs.pl or manage.phtml look like, but 
something require'd will only be loaded once.  What you should be doing
for your database connections is using Apache::DBI so whenever to
have your DBI->connect(), which should happen each script invocation,
you will get a valid cached $dbh.

If you want something always run, try using the "do $file" perl 
construct... require will only happen once, as perl thinks its some
kind of perl library that its loading, and will cache this.

> I realized this could be due to connections not closed properly, so I
> changed my script to call the sub that performs explicitly $dbh->disconnect.
> Nope, this did not solve the problem.
> 
> I then tried to put undef($dbh) after the disconnect, and got this error on
> the script the next time it was run:
> "cannot call method prepare on an undefined value".  Which basically means

It sounds like your application only tried to defined a $dbh once, 
which would make sense if your DBI->connect() happens in your required .pl.

What you might want to look into is having your DBI->connect called in 
the global.asa Script_OnStart, which runs for each script request.  The
$dbh will be global to all scripts in your web application making 
coding easier.

> that it thinks that $dbh is not defined although I define it in my file
> "subs.pl".  Like I said, there is some very wierd type of scripting going
> on, whereas certain scripts appear to remain memory resident or are not
> recompiled.  I don't know.  And this is even with StatINC=1.
> 

Apache::ASP's StatINC is not meant for .pl reloading, just .pm perl modules.  
I have never dealt with reloading .pl files and am not sure how this would work.
Can you wrap your .pl stuff into a perl package and call it a .pm ?  
Can you possibly load all the .pl stuff into global.asa, which is the 
package used for all Apache::ASP scripts ?

Good luck!

-- Joshua
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Reply via email to