Subject: | Win32-ASP called in Global.asa issue |
Date: | Fri, 24 Jul 2009 09:05:11 -0400 |
To: | <bug-win32 [...] rt.cpan.org> |
From: | <Joseph_Santiago [...] ibi.com> |
Hey there,
We have an ASP web site that uses Perlscript as the default ASP
language.
Some pages in our site are ASP (foo.asp) pages that call in .pl scripts
(in an ASP context,) run a subroutine and print out the results. Other
pages go straight to .pl scripts.
We are trying to set global variables that work in both cases. We
created a Perl module EnvVars with global values that we need in all
situations.
In our GLOBAL.asa file we have the following code:
<SCRIPT language="PERLscript" runat="server">
sub Session_OnStart {
if (defined($ENV)) {
use EnvVars;
} else {
use Win32::ASP;
Win32::ASP::LoadEnvironment;
use EnvVars;
}
$Session->{'datadir'} =
EnvVars->datadir;
#Others....
}
</SCRIPT>
Whenever I restart web services, the very first request for any page on
the site results in:
Invoking main::Session_OnStart error '80004005'
Can't call method "ServerVariables" on an undefined value at
D:/Perl/site/lib/Win32/ASP.pm line 713.
/LM/W3SVC/8/ROOT/global.asa, line 0
This is the code in ASP.pm
sub LoadEnvironment
{
for my $svar (Win32::OLE::in($::Request->ServerVariables))
{
$ENV{$svar} = $::Request->ServerVariables($svar)->{Item};
}
}
# end sub LoadEnvironment
This only happens on the very first request, whenever web services are
started. Once you refresh the page, every seems to work.
Any help would be greatly appreciated. Thanks.
Here are the details about our set-up.
Perl: v5.6.1 MSWin32-x86-multi-thread
Win-32-ASP 2.15
IIS 6 on Windows XP