[Catalyst] Running MyAppB under MyAppA (only for developers)

Jason Kohles email at jasonkohles.com
Tue Jul 31 18:47:07 GMT 2007


On Jul 25, 2007, at 3:23 PM, Oleg Pronin wrote:

> I need to plug in application B in A, so it could extend A's  
> actions under some namespace.
>
> I understand this is not so simple, but i have no other way.
> I write a dynamic admin interface (Uniadm) that will be plugged in  
> to various projects.
> It will extend functionallity of a project it was plugged in to.
> Admin interface will be available under www.myappA_site/uniadm/.
> Both Uniadm and MyApp are catalyst projects itselves.
>
> Is there a better (easier) way to solve my problem?

Not making the uniadm it's own project would make it much easier,  
instead just make it a controller base class you can inherit in each  
application that needs it.

I have a similar "universal admin" controller that is built this way...

package Admin::Base;
use strict;
use warnings;
use base qw( Catalyst::Controller );

sub main : Chained( 'base' ) PathPart('') Args(0) {
	my ( $self, $c ) = @_;
	$c->stash->{ 'template' } = 'admin/index.tt2';
}

sub list_objects : Chained('base') PathPart('list') Args(0) { ... }
# more admin functions follow, all using chained dispatch methods...
1;


Then in the project that needs an admin interface...

package MyApp::Controller::Admin;
use strict;
use warnings;
use base qw( Admin::Base );

sub base : Chained('/') PathPart('admin') Args(0) {}

1;

-- 
Jason Kohles
email at jasonkohles.com
http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire





More information about the Catalyst mailing list