Thom:
I think global.asa is only supposed to contain event-triggered
(*_On*) subroutines and maybe local subs called by the _On subs. The
best place I've found for non-event-triggered subs is in separate
modules. You can pre-load and pre-compile frequently used modules in
Application_OnStart though and then refer to them from any page.
Application_OnStart is only for GLOBAL stuff though, and I think
changes require an Apache restart (in contrast to Script_OnStart,
which is apparently re-compiled/executed every time). This also
means changes to the modules being loaded will require an Apache
restart since they are only loaded and compiled once. (I could be
wrong as I'm not the expert; this is just the behavior I've observed.)
For example, part of my global.asa might look like this.
#global.asa
sub Application_OnStart {
use InputProcessor;
use UserCheck;
# read in global config params (e.g. db connect strings)
open (CFG, '/outside/of/web/tree/app.cfg');
while (<CFG>) {
chomp;
my ($key, $value) = split;
$Application->{$key} = $value;
}
close CFG;
}
Then, for example, in login.asp I just say
#login.asp
...(html)...
<%
my $userCheck = new UserCheck;
if ($userCheck->checkUser($ASPObjects)) {
$Response->Redirect(...)
}
else { #...etc.
%>
hope this helps! If not, at least I tried :)
-dave
--- In [EMAIL PROTECTED], "Thom Crane" <[EMAIL PROTECTED]> wrote:
> Please forgive my hastiness to get this problem solved.
> I have used require "global.asa" to get my problem worked
out, but this
> doesn't seem to be the proper way of handling this file from the
reading I
> have done.
> Although not stated explicitly, it has been my feeling from
reading at the
> site and on this list that global.asa has some higher purpose than
just
> being another include file.
>
> Is using a require the proper way to handle this? If not, would
some kind
> soul (who has nothing better to do this weekend), please help out a
> burgeoning Apache::ASP user with some basics?
>
> Thanks so much.
>
> Thom
>
> -----Original Message-----
> From: Thom Crane [mailto:mail@t...]
> Sent: Saturday, October 05, 2002 11:10 AM
> To: [EMAIL PROTECTED]
> Subject: Regarding subs and global.asa
>
>
> Hello all,
> I am sure this is quite the newbie question, but alas, a
newbie I am :)
>
> I keep getting errors that say I am trying to use an
undefined sub. The
> error (regardless of which sub it points out) is in the following
form in
> the error log:
>
> <quote>
>
> [Sat Oct 5 08:34:24 2002] [error] [asp] [2246] [error] Undefined
subroutine
>
&Apache::ASP::Compiles::__ASP__tmpx9936a616c549519afe239b14a8568b6c::m
ysub
> called at index.asp line 210. <--> ,
> /usr/lib/perl5/site_perl/5.6.0/Apache/ASP.pm line 1413
>
> </quote>
>
> In this case, I am calling the sub in this manner in the program:
>
> &mysub()
>
> My global.asa is set up as follows:
>
> #global.asa
>
> sub mysub{
>
> ...lots o' code...
> }
>
> I have tried with all my might to find the answer to this conundrum
on the
> web site and archives, but I am newbie enough not to be able to put
together
> the clues...
>
> Any ideas, comments, tongue-lashings? <g>
>
> Thanks in advance,
>
> Thom Crane
>
>
>
>
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]