We are trying to migrate an existing CGI codebase to mod_perl (Apache::Registry) for performance reasons. The problem we are having is with name-spaces, because the product is composed of a 'global' instance, and possibly many 'local' instances. Currently it works like this:

How it Works Today

When a local instance is created, a new tree is created which is a copy of the global instance, and all of the CGIs and modules are symbolically linked to the global instance. This way, the global instance can be updated, and the local instance will get the changes, unless the local instance has modifications. A local instance is modified by breaking the symbolic link, i.e. copying the file to the local instance. This way local modifications can be made, with the tradeoff that global updates won't be seen. The CGIs use the local modules by modifying @INC to look in the local 'lib' diretory first.

Thus, all the CGIs and modules in all the instances use a module, which will be found in the local instance's include directory, but the module itself may or may not be a link to the global instance.

The example CGI would look like this:

#!perl BEGIN { unshift @INC, "$ENV{LOCAL_INSTANCE}/lib"; } use Some::Module; # ...

The Problem Using mod_perl

When we try to run this under mod_perl, the system breaks down. The first time a particular apache child gets called, it's compiled, and uses the module appropriate for the instance. But the next time it gets called, for possibly some other instance, it's still using the module that was compiled the first time. We need to the CGI to uise the module that is appropriate for the instance that it was caled for.

Solutions We Are Considering

How You Can Help

Has anyone run into this sort of problem before, and come up with a workable solution?

--
edan (formerly known as 3dan)


In reply to Name-Space problems migrating to Apache::Registry by edan

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.