[Catalyst] Reusing application on two virtual hosts with mod_perl

Ralph Meek ralph at usrmedia.com
Sun Apr 9 16:16:33 CEST 2006


Hmm ok that is a possibility, but i think using the CATALYST_HOME would be the 
way it's supposed to be. As a sort of hack I added the following to my 
'begin' handler:

if(defined($ENV{CATALYST_HOME})) {
    if ($c->config->{home} ne $ENV{CATALYST_HOME}) {
        $c->setup_home($ENV{CATALYST_HOME});
    }
}

It's still a hack but at least I can now use the env var in my apache config. 
I wonder if this is a bug or that it can be solved otherwise..

Ralph

On Sunday 09 April 2006 15:04, Zbigniew Lukasiak wrote:
> Hi,
>
> How about having a config file with:
>
> www.first.domain.com => template1,
> www.second.domain.com => template2,
> ...
> ?
>
> That is using the address - available in $c->req->base - to choose the
> templates.
>
> -- Zbyszek
>
> On 4/9/06, Ralph Meek <ralph at usrmedia.com> wrote:
> > I have written several Catalyst applications that run as virtrual hosts
> > on a server with mod_perl. That all works very well. Now I need to make a
> > new application that is very similar to an application I already have so
> > I was wondering if it is possible to reuse the existing module. What I
> > tried to do is the following:
> >
> > The existing application is defined as follows in the apache config:
> >
> >     <Location />
> >         SetHandler          modperl
> >         PerlResponseHandler Myapp
> >     </Location>
> >
> >
> > In the second vhost I did the following definition:
> >
> >
> >     <Location />
> >         PerSetEnv CATALYST_HOME "/data/wwwroot/myapp2"
> >         SetHandler          modperl
> >         PerlResponseHandler Myapp
> >     </Location>
> >
> > This way I was hoping to have the same application with just a different
> > home dir (templates, static files, etc) but somehow Catalyst doesn't pick
> > up the specified CATALYST_HOME. Even if I have only one application, it
> > doesn't seem to pick it up.
> >
> > How can I use the same Catalyst application on two vhosts with different
> > templates?
> >
> > Ralph
> >
> > _______________________________________________
> > Catalyst mailing list
> > Catalyst at lists.rawmode.org
> > http://lists.rawmode.org/mailman/listinfo/catalyst
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst



More information about the Catalyst mailing list