Warren Young wrote:

What I've been trying to do is not dramatically different from that. I've been trying to save a calculated value to $Application->{foo}, and print it out later in some of the .asp files. Its failure to work is what prompted my original post.



Currently, Application_OnStart only runs when the first Session gets initialized, and again after the last Session expires. Theoretically, this could never happen if your application is always busy. A big difference between Apache::ASP, and IIS/ASP is that sessions persist by default beyond the web server stop/start by writing to StateDir.

I have had requests to allow for the Application_OnStart to run when
the web server first starts up.  This would be fairly had to do, but
it might be possible.  The requests for this have been sporadic, and
it has never been one of my top priorities, should it be?

Until then, what I recommend is that you either calculate your value
in Script_OnStart and cache it as a global there, like this:

  # global.asa, cache on script execution first time
  use vars qw($Cached);
  sub Script_OnStart {
    $Cached ||= &calculate_now();
    ...
  }

instead of calculating once per server start, it will be calculated
once per web process initialization of global.asa.  Better yet, you could:

  # global.asa, cache on global.asa compilation
  use vars qw($Cached);
  $Cached ||= &calculate_now();
  sub Script_OnStart {
    ...
  }

and this would be cached on global.asa compilation, which if you are
using script preloading with Loader(), then you will actually get this
calculation done during the parent web process init, so would in effect
get this just once per server start if that is what you really want.
Another way to achieve this is to just write a perl module and calculate
the value there, and load it with PerlModule, or PerlRequire startup.pl,
both of which are mod_perl conventions.

Regards,

Josh

________________________________________________________________________
Josh Chamas, Founder    | NodeWorks - http://www.nodeworks.com
Chamas Enterprises Inc. | NodeWorks Directory - http://dir.nodeworks.com
http://www.chamas.com   | Apache::ASP - http://www.apache-asp.org



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to