On Wed, Dec 16, 2009 at 8:13 AM, Bill Moseley <[email protected]> wrote: > I have an existing application Foo. I'd like to create a new application > Bar that has very similar actions. > > What I'm wondering is if there's a way where I could run catalyst.pl Bar to > create a new empty application and then tell it to inherit from Foo. That > is load_components would load all of Foo's Models, View, Controllers > (basically creating in-memory empty sub-classes for each component) and > setting up all actions as if they were in Bar. I could then override or add > additinal actions as needed to Bar::Controller::Whatever, which would > inherit from Foo::Controller::Whatever. > > Any ideas how to implement something like that? >
You can configure the locate_components method (or, subclass it in your application): http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80016/lib/Catalyst.pm#$c->locate_components(_$setup_component_config_) The documentation seems quite sparse, but if you look at the source it just essentially does: my $locator = Module::Pluggable::Object->new( search_path => [ map { s/^(?=::)/$class/; $_; } @paths ], %$config ); If you have MyApp->config->{search_extra} = [ 'Foo::Controller', 'Foo::Model' ]; it should DTRT. I think :) -J _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
