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

Peter Karman peter at peknet.com
Wed May 2 14:38:49 GMT 2007



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.

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com



More information about the Catalyst mailing list