This sounds very much like the "will not stay shared" warning that you can get when you take a CGI and use it in mod_perl. Does ISAPI.dll wrap the *.pl file into a subroutine like Apache::Registry does?
The descriptions of Perl for ISAPI make it sound much like mod_perl / Apache::Registry but I could not find any cases of anybody actually documenting what it does or even mentioning "wrapping the script in a sub" much less noting the need to deal with file-scoped lexicals being used by subs in order to avoid "will not stay shared" problems (but I didn't spend a lot of time searching and scanning).
The linked searches should find you a lot of information about this problem in case you are interested in understanding it better.
If this is indeed the same problem, then the least-change way to fix your script would be to go from its current pattern:
declare and initialize variables with static data
code to be run
subroutines that use above variables
to a pattern like:
BEGIN {
declare and initialize variables with static data
Main();
sub Main {
code to be run
}
subroutines that use above variables
}
So you can probably fix your script by adding 5 lines of code ("BEGIN {", "Main();", "sub Main {", "}", and "}").
But such a change will leave your script easy to break under mod_perl / PerlIS because it will be easy to stick something that isn't "declare and initialize variables with static data" into that first chunk of code. Which is why you might want to learn more about this particular problem and why you have to do these things to avoid it.
This is just one of the reason why I still code in a style very much like the one I outlined long ago at (tye)Re: Stupid question (now updated with some justifications).
|