Posted on 2005-02-25 21:31:16-08 by mreece
multiple MasonX::Maypole apps
has the trick been perfected for running multiple MasonX::Maypole apps under one (mod_perl) web server?

i have no VirtualHosts, only multiple Location blocks.

i have tried various combinations of
__PACKAGE__->config( Maypole::Config->new() );
and
__PACKAGE__->config->masonx( {} );
within and without my
BEGIN { MyApp->setup(...) }
block, and get 'Can't call method "class_of" on an undefined value' errors depending on some requests (seems to depend on which httpd instance gets the connection).

any tips?
Direct Responses: 160 | Write a response
Posted on 2005-02-28 10:32:03-08 by davebaird in response to 152
Re: multiple MasonX::Maypole apps

I have it running multiple apps in separate vhosts, but there should be no problem in principle running multiple locations within a host. But some more detail would be useful, like relevant bits of your Apache conf and Maypole app classes.

There may also be some interaction between Apache::MVC::parse_location, which uses the Location parameter in your Apache config, and other bits of MasonX::Maypole, your app code, and the templates, which seem to use $self->config->uri_base as a synonym. There is a parse_location method in the docs for MasonX::Maypole that you can use to override the Apache::MVC method. Just a hunch, might be worth trying or just for thinking about.

The things you are trying are in the area I would be looking at first as well. The main idea for multiple apps is to set up an empty config structure during initialisation, before any of the application-specific code gets loaded, so that each app can then inherit its own copy of the (empty) config, and then modify it locally, rather than setting up a race where the first app to get initialized, ends up setting the configuration inherited by all apps. Class data are stored using Class::Data::Inheritable, which has this behaviour.

Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.