in reply to Re: mod_perl, and weird caching
in thread mod_perl, and weird caching

Hi,

Thanks for the reply!

I had a feeling you were gonna say that :/ For the different module names... that doesn't sound like fun! Would it work by for example, changing:

domain 1: lib/Foo/Bar.pm
domain 2: lib/Foo2/Bar.pm

use a single (common) module and configure the differences using a per-vhost configuration object.
Could you explain this a bit more?

Thanks!

Andy

Replies are listed 'Best First'.
Re^3: mod_perl, and weird caching
by MidLifeXis (Monsignor) on Feb 04, 2014 at 18:43 UTC

    Sure,

    You would make your module generic, so that it works with all of your vhosts. You would then configure the code based on some vhost specific setting. So for example, if you have a vhost-specific configuration file indicating the graphics file names for specific UI components, you could configure that file name in a per-vhost PerlVar.

    In your code, you could access this per-vhost setting. You could then use that setting to identify the location of the configuration file for that vhost, read the configuration, and respond.

    Basically, a persistent environment like mod_perl assumes that you are not changing the foundation that you are building the application upon. In order for that to hold true, you need to isolate the moving parts into something that you pass through the building infrastructure.

    --MidLifeXis

      Thanks for the detailed info. I'm not too sure how practice thats gonna be for the site (they are quite old, and pretty large). Maybe I'll have to get a dev install configured, and then play around with whats needed to change the module folders names around... i.e we have GT , Links and Plugin... so I could just rename them to GT2, Links2, Plugins2 - and update anywhere that calls them. Hardly ideal, but it would hopefully work.

      Someone also said this to me:

      You can't run multiple domains in the same mod_perl instance, major
      security risk. You need a separate physical apache process per domain.
      How would one go about setting separate Apache processes up? Sorry for my ignorance... I've been hosted on managed hosting for most of my time, so this is all quite new to me =)

      TIA

        Multiple apachectl calls with different configurations, all wrapped up on the front end with an nginx or another non-mod_perl apache front end.

        And the one mod_perl perl domain is correct, unless all of the domains are under a single controlling entity. Any mod_perl-enabled domain is able to impact the performance and operation of any other mod_perl instance on that apache server, as they share the same perl space in memory.

        --MidLifeXis