Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of LTjake (4001)

Monday July 04, 2005
10:33 AM

Multiple mod_perl apps under a single code base

[ #25507 ]

... specifically I'm trying to run multiple copies of a Catalyst application under the same Apache server with different config files.

Does anyone have any strategies for running the same set of perl modules against an arbitrary external file?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • You can't do this, because mod_perl shares the namespaces in use amongst all Apache processes. That means $MyApp::foo is global.

    Unless Catalyst is being very, very clever and not using any global or class variables at all. It's possible, but quite difficult as it involves rebuilding lots of things on each request. (random act of guesswork)

    This sort of thing is easy with PHP, though. :)

    -Dom

    • Actually this is very easy. Put everything that is shared in the same namespace, put everything that isnt in different namespaces.

      Ok, its not that easy, but you get a lot of saves memory for it. You should be alright, if you control all apps and test them together :)

      • But the different namespaces are still shared. You need some initial thing to point it at the individual namespace that it should be using. For example,

        <Location /MyApp1>
          PerlSetVar MyAppPackage My::App1
          PerlHandler My::App
        </Location>
        <Location /MyApp2>
          PerlSetVar MyAppPackage My::App2
          PerlHandler My::App
        </Location>

        But I still reckon it's easy to break, particularly when compared to PHP's shared nothing philosophy.

        -Dom

  • Please take a look at this thread: http://lists.rawmode.org/pipermail/catalyst/2005-May/000419.html [rawmode.org] on the mailing list. Apparently sri commited mreece's suggestion and it *should* work.