[Catalyst] Sub-classing Application

Bill Moseley moseley at hank.org
Mon Jan 4 18:06:32 GMT 2010


On Sun, Dec 20, 2009 at 3:05 PM, Matthias Dietrich <mdietrich at cpan.org>wrot=
e:

> Hi,
>
> I'd like to catch up this slightly old topic...
>
> I've build a small app for a customer and want to pull out some sections =
to
> build a small CMS I can use in several upcoming apps.  I don't want to
> copy-paste everything everytime an app comes up or update all instances. =
 So
> it would be very nice to teach an arbitrary Catalyst app to glue everythi=
ng
> from another app (controllers, models *and* views (note: html and static
> files, too!)) into the arbitrary app.
>
> There were several ideas in the past on this list to "featurize" apps, li=
ke
> the solution CatalystX::Featurizer/CatalystX::Features posted by Rodrigo.
>  The problem with this solution is: features cannot "just" be released to
> CPAN and used by other persons without requiring them to change their
> Catalyst app heavily.  What I'm thinking of is something like "use
> base/parent" with specifying an action where the external Catalyst app is
> connected.
>

I'm more concerned about code reuse and maintenance in a set of large and
similar applications.   CatalystX::Features seems like a good approach for a
large application that is made up of different features (or "products") that
may be managed by different teams.

That's a slightly different problem than one of code-reuse I initially
posted about.  In addition to the need to have features/components/products
managed separately and combined into a larger application I need to use
those parts in different applications that are slightly different.

That is, I need a second application that is very similar to the first, but
with slightly different controllers and somewhat different templates, css,
js. etc.

So, I've been thinking about building the controllers as Moose roles.  Then
build CatalystX::Features grouped by application where the Feature's
controllers use the roles (and override as needed).

I'm much less clear how to reuse/share templates and css between
applications -- but in that case it might just be better to copy.

The trade-off will be files scattered all over the place, something
developers are still trying to get used to with basic Catalyst.  Maybe
someone here can come up with something more clever.  But, do need a better
way to manage large applications.

I'm also debating CatalystX::Features approach vs. just using separate
applications (with shared sessions, etc.).  That's a bit more flexible for
deployment (e.g. some features on a subset of servers) but sharing of common
templates, css, js, etc. is more of a challenge.



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100104/08339=
53d/attachment.htm


More information about the Catalyst mailing list