[Catalyst] Splitting up a large application: Shared config and templates for multiple applications

Rodrigo rodrigolive at gmail.com
Fri Aug 28 16:55:12 GMT 2009


> Anyone building applications out of multiple small Catalyst applications
> like this?  How do you set up the apps to share templates and a config?
> Anything more interesting than passing in paths?
>
>
I have a working module called CatalystX::Featurizer that I've been using in
an app at $work. It's still at a very early stage, but I'm just going to
push early. No POD included, no tests... You've been warned. :D

http://github.com/rodrigolive/catalystx_featurizer

It's a mix of Eclipse features/plugins and RoR plugins. Ideas are welcome. I
have many myself... just don't have time to implement them all right now.

Since there is no POD, I've included a very simple TestApp. Basically the
idea is:

- create a /features directory under your app home.
- each feature home dir should be named something like

/features/my.demo.feature_1.0.0

- it's a split on underscore "_", the first part is the feature name (very
javaish, I know, with dots and all), the second is the version.
- if a higher version of a feature is found, that's the one to be used, the
rest is ignored
- a feature without a version is ok, it will be the highest version
available - good for local dev and pushing to a repository.
- a debug box is printed on startup, so you can check which version is
running:

[debug] Features Loaded:
.----------------------------------------+------------------------+--------=
--.
| Feature Name                           | Class                  | Version
|
+----------------------------------------+------------------------+--------=
--+
| simple.feature_1.0.0                   | simple.feature         | 1.0.0
|
.-----------------------------------------------------------------+--------=
--.


- the idea is to merge /root dirs (right now for Static::Simple, TT and
Mason)
- controllers, models, schema, etc. should work just like when underneath
MyApp/lib
- simple.feature.conf is loaded as part of the main conf (appended) - the
filename has to match the feature "class" name, ie "simple.feature".
- extend the main app part by part (depending on your needs), replacing the
standard plugin with an extended one:

use Catalyst qw/-Debug
                +CatalystX::Featurizer  ---- this one is a must, loads
features and push things into @INC
                +CatalystX::Featurizer::Plugin::ConfigLoader   -----
optional
                +CatalystX::Featurizer::Plugin::Static::Simple  ------
optional
/;

- I'm also including CF::View::Mason and CF::View::TT. To use them, just
subclass it in your MyApp::View::TT or Mason, instead of the C::V::TT,Mason.
- a CF::Plugin::I18N is included too.
- $c->features returns an array of CF::Feature objects that can be used to
identify features, etc.

Let me know what you think.

cheers
   -rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090828/c4382=
899/attachment.htm


More information about the Catalyst mailing list