[Thamesvalley-pm] Mojolicious and Catalyst

Andrew thamesvalley-pm at unitedgames.co.uk
Thu Apr 14 10:04:09 PDT 2016


Yes, I'm hoping to learn more about DBIx::Class, =).

I remember helpers from my experience with Mojolicious.
The code I was doing was integrating with their existing code, and Nigel
Hamilton had already coded a helper for something or another, that I ended
up being able to use.
Sorry for being vague - it has been a year since I used Mojolicious, =).

It was super cool that I got confused by a bit of the documentation however,
mentioned it in the mailing list, and the documentation was updated
immediately, =). Community felt very active,  =).



----- Original Message -----
From: "Oliver Gorwits" <oliver at cpan.org>
To: <thamesvalley-pm at pm.org>
Sent: Thursday, April 14, 2016 4:58 PM
Subject: Re: [Thamesvalley-pm] Mojolicious and Catalyst



On 2016-04-14 13:21, Andrew wrote:
> my perl code is just going in the controller folder. I don't yet
> understand
> why a bit of code goes in a view folder or model folder - it's not the
> model
> or the view, it's still processing, it's still code.

I think it's down to how you want to separate the parts of your
application. The idea is that one part of code should not [need to] know
too much about how another part gets its job done. You make the point
already in your "hot swapping" comment but it's also about the ability
to make small changes to code more easily, to test code in isolation, to
limit the impact of bugs, and so on.

In Mojolicious the View (Output) and Controller (Processing) are sort of
mushed together, which is why you might be missing the View code.

For the Model, what I tend to do is write "wrapper" or "helper"
subroutines that take friendly parameters, perform basic sanity checks,
execute the necessary SQL, and return some sort of data structure. For
example get_user($id) or whatever, running SELECT ... FROM and returning
a hash. If you go for something more involved such as DBIx::Class then
you can get fancy with its Virtual Table (~view) feature and embed quite
a lot into the [data-]model.

regards,
oliver.
_______________________________________________
Thamesvalley-pm mailing list
Thamesvalley-pm at pm.org
http://mail.pm.org/mailman/listinfo/thamesvalley-pm



More information about the Thamesvalley-pm mailing list