in reply to Re: how mod_perl finds if code has already been compiled
in thread how mod_perl finds if code has already been compiled

I read the whole tuning stuff several times but it's very dense, I guess I'll have to re read it many times before really understanding the "Whole Big Picture of Things"

Ok to make things clearer:

I use only MethodHandlers.
My modules reside in a structure like this: Projet1/handler1.pm
Projet1/handler2.pm
And I have a
lib/Project1Config1/param.pm
lib/Project1Config2/param.pm

Each vHost uses the same module, except for the config file
And I'm asking myself a lot of silly question on wether it is efficient or not, wheter I could find a way to organize things to save up memory
It seems that the answer is no, exept if I preload the handler modules at startup, but I have to be sure that the right vHost gets the right config file, and that things don't mess up along the way.

I'll be reading your links right away, thanx :)
  • Comment on Re: Re: how mod_perl finds if code has already been compiled

Replies are listed 'Best First'.
Re: Re: Re: how mod_perl finds if code has already been compiled
by ViceRaid (Chaplain) on Jun 16, 2003 at 16:56 UTC

    Perhaps I've misunderstood your question, but perhaps it might work if you created instances of the generic handler class, with the configuration file passed as an argument to the constructor. Then you'd only be use the generic class once, and creating a differently configured handler instance to do the work for each vhost. This reworking should be fairly painless if you're already using method handlers. So, for each host you might have something like the following in startup.pl:

    # startup1.pl use GenericModule; $My::VirtualHost_1_Handler = GenericModule->new( 'config' => '/path/to/lib/Project1Config1/param.pm' );

    Then in your VirtualHost section:

    PerlRequire '/path/to/startup1.pl' SetHandler perl-script PerlHandler $My::VirtualHost_1_Handler->handle

    Then all you'd need to add would be some code to your generic class's new method that reads in the configuration variables and sets them as attributes of the specific instances. Each virtual host could then have one or more separate handler object instances, each with its own private configuration variables held as object attributes.

    HTH
    ViceRaid

      This would be a very good solution indeed if my module was object oriented...
      I found some stuff about why what I wanted to do isn't possible on : Name Collision of Modules and libs
      A very interesting reading for us mod_perl users.
      Now I think i will use a method based on the previous link: Config Files, using a hash with a key for each vHost.