Thanks in advance to anyone who can help me...

I am writing a fairly large site that breaks up common functions into multiple libraries that are loaded by calling a single module (LOADER.pm).

This is the code for LOADER.pm:
package LOADER; require Exporter; use vars qw( $ROOTDIR $ROOTSERVER $ROOTNAME @importList @onDemandImportList %onDemandGroups @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION ); $ROOTDIR = '/some/dir/'; $ROOTSERVER = 'someurl.com'; $ROOTNAME = 'some name'; @importList = qw( $ROOTDIR $ROOTNAME $ROOTSERVER ); @onDemandImportList; %onDemandGroups; require qq|$ROOTDIR/LIBS/FUNCTIONS.pl|; require qq|$ROOTDIR/LIBS/HTML.pl|; require qq|$ROOTDIR/LIBS/TEMPLATE.pl|; require qq|$ROOTDIR/LIBS/FORM.pl|; require qq|$ROOTDIR/LIBS/IMAGE.pl|; require qq|$ROOTDIR/LIBS/USER.pl|; require qq|$ROOTDIR/LIBS/SECURE.pl|; require qq|$ROOTDIR/LIBS/BOARD.pl|; require qq|$ROOTDIR/LIBS/GLOBALS.pl|; require qq|$ROOTDIR/LIBS/INIT.pl|; @ISA = qw(Exporter); @EXPORT = @importList; @EXPORT_OK = @onDemandImportList; %EXPORT_TAGS = %onDemandGroups; $VERSION = 1.00;

For example, say have libs: A.pl, B.pl, and C.pl. The LOADER.pm package would only load those functions from those libs as called by the referring script (ie use LOADER qw(some functions); by using a require for each lib)

Problem is... I have two libs that contain globals, one that contains static globals (GLOBALS.pl) and one that contains dynamic globals (INIT.pl) that are dependent on the request from the user. Some of these globals are the args variable and some security and account globals.

This works fine running normally under Perl and Apache, but I would like to use mod_perl. The site works fine for the first few loads, but as soon as the child processes are called again the dynamic globals get all mixed up. I've been told Globals should always be avoided, but I could not think of other ways of sharing info across all libs and the calling script.

I declare all globals with use vars and I tried using a "do" rather than "require" for the dynamic lib in the package call... still no luck. I just want the globals to be refreshed (basically rerun the dynamic lib) every time a script is run.

Any ideas?

In reply to mod perl global initialization by sliver

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.