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).

- tye        


In reply to Re^3: Scripts work under perl .exe but not ISAPI (~= mod_perl?) by tye
in thread Scripts work under perl .exe but not ISAPI by Eagle_f91

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.