[Catalyst] Best practices: XML output from static XML

J. Shirley jshirley at gmail.com
Fri Mar 5 20:20:22 GMT 2010

On Fri, Mar 5, 2010 at 11:31 AM, Mesdaq, Ali <amesdaq at websense.com> wrote:
> To me this sounds like it’s the same issue as serving static images you
> wouldn’t create a view for that unless you need to wrap it around some
> application logic. Or at least that’s what it sounds like to me based on the
> information provided. We could take the MVC concept really far and say that
> static files need to have a filesystem Model with Controller logic for
> finding the files and each have their own View for each filetype.

I would say that putting it into a view allows a greater degree of
future-proof and foresight.  Putting it into the controller would work
fine, up until you need to serve another static file (or a different
file), or add an access control layer, or switch to use sendfile, or
switch to start serving from something like MogileFS.

If you put it all the above in one method, why put it in a controller
rather than a view?

In all of what you said you haven't actually said what is wrong with
using a view.

I would certainly recommend that serving static files would be done by
the webserver and render this moot.  However, if you want to use
Catalyst to serve a static file (which would only make sense if there
*is* application logic) putting this in a View would be the Right Way.


More information about the Catalyst mailing list