[Catalyst] Running multiple catalyst apps under mod_perl

Michael Reece mreece at sacbee.com
Tue Mar 29 02:58:43 CEST 2005


Putting

__PACKAGE__->actions( {} );

before my actions setup seems to solve this problem, but I worry about other
similar uses of Class::Data::Inheritable.

On 3/28/05 4:39 PM, "Michael Reece" <mreece at sacbee.com> wrote:

> Preliminary troubleshooting shows that sometimes the app has the wrong
> actions.
> 
> I added the following statement to Engine.pm's sub action:
> 
> use Data::Dumper; warn "my ($self) actions are ", Dumper
> $self->actions->{plain}->{$action};
> 
> Usually I get:
> 
> my (Test1=HASH(0x875aed8)) actions are [
>         'Test1',
>         sub { "DUMMY" }
>       ]
> Test1 (Test1) default action called as Test1 at
> /usr/local/apache_perl/packages/Test1/lib/Test1.pm line 18.
> 
> 
> But occassionally (after viewing http://localhost/test2 a few times, then
> going back to http://localhost/test1) I get:
> 
> my (Test1=HASH(0x8638d38)) actions are [
>         'Test2',
>         sub { "DUMMY" }
>       ]
> Test2 (Test2) default action called as Test2 at
> /usr/local/apache_perl/packages/Test2/lib/Test2.pm line 18.
> 
> 
> 
> 
> On 3/28/05 3:29 PM, "Michael Reece" <mreece at sacbee.com> wrote:
> 
>> I spoke too soon.  Each Catalyst app appears to be willing to handle the
>> requests of the other.
>> 
>> I set up two small test applications.
>> 
>> ----------
>> package Test1;
>> 
>> use strict;
>> use Catalyst qw/-Debug/;
>> 
>> Test1->config(
>>   name => 'Test1',
>>   root => '/usr/local/apache_perl/packages/Test1/root',
>> );
>> 
>> Test1->action(
>>   '!default' => sub {
>>       my ( $self, $c ) = @_;
>>       $c->res->output('Congratulations, Test1 is on Catalyst!');
>>   },
>> );
>> ----------
>> 
>> And:
>> 
>> ----------
>> package Test2;
>> 
>> use strict;
>> use Catalyst qw/-Debug/;
>> 
>> Test2->config(
>>   name => 'Test2',
>>   root => '/usr/local/apache_perl/packages/Test2/root',
>> );
>> 
>> Test2->action(
>>   '!default' => sub {
>>       my ( $self, $c ) = @_;
>>       $c->res->output('Congratulations, Test2 is on Catalyst!');
>>   },
>> );
>> ----------
>> 
>> And, in httpd.conf:
>> 
>> ----------
>> <Location /test1>
>>   <Perl>
>>   use lib '/usr/local/apache_perl/packages/Test1/lib';
>>   </Perl>
>>   SetHandler perl-script
>>   PerlHandler Test1
>> </Location>
>>   
>> <Location /test2>
>>   <Perl>
>>   use lib '/usr/local/apache_perl/packages/Test2/lib';
>>   </Perl>
>>   SetHandler perl-script
>>   PerlHandler Test2
>> </Location>
>> ----------
>> 
>> And, it is a virtual coin-flip as to which message gets displayed (Test1 vs
>> Test2) at either URL, http://localhost/test1 and http://localhost/test2
>> 
>> Any ideas?
>> 
>> 
>> On 3/28/05 3:11 PM, "Michael Reece" <mreece at sacbee.com> wrote:
>> 
>>> Also, to follow up on my initial reasons for testing, Catalyst appears to
>>> behave wonderfully with multiple applications.
>> 
>>> On 3/28/05 2:25 PM, "Michael Reece" <mreece at sacbee.com> wrote:
>> 
>>>>> I am testing out Catalyst as an alternative to Maypole (specifically
>>>>> MasonX::Maypole).  My major gripe about Maypole and MXM is that it shares
>>>>> config data across applications and I have not been able to reconcile all
>>>>> the issues in order to run multiple apps on the same mod_perl apache
>>>>> (Apache/1.3.27).
>> 
>> 
>> _______________________________________________
>> Catalyst mailing list
>> Catalyst at lists.rawmode.org
>> http://lists.rawmode.org/mailman/listinfo/catalyst
>> 

-- 
michael reece :: web engineer :: mreece at sacbee.com :: (916)321-1249





More information about the Catalyst mailing list