Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

First of all, you shouldn't do that.

You are coupling controller, view and model logic in your controller action. You shouldn't "prepare things for the view" in the controller, but rather just "prepare the context for the view". That meaning, if you're in a inner context (such as one individual customer), the controller should set this up. But NEVER build data structures that are specific for one view.

You should use more of the TT programming language for such things. In a lot of cases, your controller action will be just empty, because context was defined in an earlier chained action, and you just need to dispatch to one specific view (most of the time, to one specific template).

That means that you are going to do a lot of "search" calls directyly in your template, but THAT'S OK!!. That's how MVC is supposed to be, remember. It's not a layered schema, it's a triangle.

    M
    ^^
   /  \
  V<---C

Which means, the model is accessed both by the controller and the view, and the controller just dispatches to the view. It is very important that you do not couple the controller to the view, otherwise, implementing an alternative view (RSS, ATOM, email) will be very hard.

daniel

In reply to Re: How to organize Catalyst stash by ruoso
in thread How to organize Catalyst stash by roman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (8)
    As of 2014-12-28 19:49 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (182 votes), past polls