SPUG: Apache and Modules

Colin Meyer cmeyer at helvella.org
Wed Jan 23 22:44:25 CST 2002


On Wed, Jan 23, 2002 at 06:59:43PM -0800, Yitzchak Scott-Thoennes wrote:
> Colin Meyer <cmeyer at helvella.org> wrote:
> >A super ugly kludge could be:
> >
> >  use lib '/my/own/private/idaho';
> >  delete $INC{Config}
> >  require Config; Config::import;
> 
> You probably want a:
>   use Symbol ();
>   Symbol::delete_package 'Config';
> before the require, to start with a fresh %Config namespace.

You are right.  Another problem that occurred to me immediately after
posting the above is that the 'use lib' statement will only run once, 
as the script gets compiled.  The following might work better:

  {local @INC;
   unshift @INC, '/my/private/libdir';
   Symbol::delete_package 'Config';
   require Config; 
   Config::import; # if it needs it
  }

It's obviously a lousy workaround to account for duplicate use of
a namespace. Not only that, but it foils some of mod_perl's usefulness
by re-loading some code for each request.

  use MyApp::Config; # much nicer ;-)

Have fun,
-C.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list