On Sun, Apr 2, 2017 at 9:29 PM, iaw4 <[email protected]> wrote:

> I would like to keep my view together with my controller.
>

This sounds in opposition of good / supported design.  Reference
<http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Model-View-Controller>


> My model sits in the perl model.pm file.  So, I want 'use model' be
> picked up inside my index.html.ep template.  Is there a way to wholesale
> import `model.pm`, just as I could use it in controller perl code, and
> then I could use the model's subs in the template perl section?  help, as
> always, appreciated.
>

You want the view to have access to the Model, just as the Controller
would?  Reference
<http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Model>

Using a helper in your Controller, you'll store your Model object, and your
View will have access to your Controller's helper which stores the Model.
This will give you access to the Model's subs.

Pay special attention to the last block of code in the second Reference I
gave, "Model".

Feel free to ask any questions about this documentation from the Mojolicious
Growing Guide <http://mojolicious.org/perldoc/Mojolicious/Guides/Growing>.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to