[Catalyst] New view: ICal?

John Napiorkowski jjn1056 at yahoo.com
Fri Mar 4 15:42:45 GMT 2016


If you don't have a lot of view only logic (the view is just a dumb 'take this perl data structure, convert it to a display format using default serialization rules and send it to the response) then a thin view adaptor with Catalyst::Model::Adaptor might be the easiest thing.  If you are using the most recent Catalyst you could even avoid the need for a boilerplate proxy class using component injection.
Then main thing is thinking about how to shuffle data to the view.  Most current art uses the stash, but lately I prefer to avoid that and use either a dedicated view model, or the default model, so that I can properly constrain my data and offer the view better view only logic.
In general think 'how can I do something generally useful' over 'what is the Catalyst way to do this'.  Ideally your Catalyst components (models, views, etc) are the thinnest possible layer to adapt a stand alone model.
jnap 

    On Friday, March 4, 2016 4:28 AM, Kieren Diment <diment at gmail.com> wrote:
 

 looks to me like you'd want Catalyst::Model::Adaptor + Data::iCal + an optional very thin view that did something like:

    $c->res->content_type($ical_content_type);
    $c->res->body($c->stash->{calendar});

in the process method, and not much else.

The reason you don't see views for stuff like this much in catalyst land is that this kind of thing is usually pretty simple.

On Fri, Mar 4, 2016 at 8:22 PM, Chris Welch <welch.chris at gmail.com> wrote:

Thanks for the reply - may I ask what the model would be doing, given that presumably it would have to go through a view in the end anyway?  Because the data itself already exists in a model, all I'm wanting to do effectively is extract that and display it in a slightly different format, so I'm surprised that another model is the way to go - but then I've sort of been learning as I go with this stuff, so I may well be missing something fundamental!
Thanks
_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/




_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160304/078d078a/attachment-0001.htm>


More information about the Catalyst mailing list