[Catalyst] How to make MyApp::B a part of MyApp::A ?

Christopher H. Laco claco at chrislaco.com
Wed May 2 15:30:15 GMT 2007


Peter Karman wrote:
> =

> =

> Oleg Pronin scribbled on 5/2/07 5:30 AM:
>> Greetings!
>>
>> I want to make MyApp::B a part of MyApp::A under namespace for example
>> /folder/
>>
>> Both B and A are normal catalyst applications. (both do
>> '__PACKAGE__->setup()' and etc. and therefore cannot work together).
>>
>> How to do this with minimal changes to application A (for example,
>> using B
>> as plugin) and any complex changes to application B ?
>>
>> I do not want to do this using apache features (setting MyApp::B's
>> handler
>> to location /folder/).
>> I want this: if MyApp::A loads MyApp::B as plugin then all of
>> functionalities of B goes under A/folder/.
>>
> =

> this sounds like a straightforward subclassing arrangement -- unless I'm
> missing something crucial?
> =

> MyBaseClass.pm:
> =

>  package MyBaseClass;
> =

>  # all the stuff currently in MyApp::B here
> =

>  1;
> =

> MyApp/A.pm:
> =

>  package MyApp::A;
>  use base qw( MyBaseClass );
>  1;
> =

> MyApp/B.pm:
> =

>  package MyApp::B;
>  use base qw( MyBaseClass );
>  1;
> =

> =

> then override and extend MyApp::A and MyApp::B for whatever
> application-specific reasons you have.
> =


This sounds good on paper, but in practice it doesn't work. (assuming
::A and ::B containg the Cat stuff like ->setup, Catalyst
qw/Plugins..,/, etc.


You can only call setup once which means you have to put the A stuff in
A, and the B stuff in B, mostly killing the point of subclassing...

Of course, I could be missing the point...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070502/55eb=
0fc6/signature.pgp


More information about the Catalyst mailing list