I need wisdom on structuring procedural code in Catalyst

My status:
- I am porting a REAL working Flex application while learning Catalyst and remembering Perl
- I would like to stick to the Catalyst easiest ways before being "creative"

The structure:
- I have a Controller for "People" with subs like list, detail, edit, notify, etc
- In Detail view I get data from two sources:

  • MySql, using a Result Set
  • SOAP, from a remote app, using SOAP::Lite
  • - After retrieving everything from the two sources, data is mixed and processed (like invoices, debts or connections), preferences are applied and the right information is displayed depending of the user permissions.

    The problem:
    - As I am adding functions, the Controller is getting bigger, and I have learned that controllers must be thin.
    - The SOAP process itself also have a lot of code to retrieve and process incoming data, and I do not know how to isolate like the same way as the Result Set from MySql

    My question:
    - Where that code belongs to?
    - An Included file seems to be very ugly, or not?
    - Mostly it is procedural logic. But I imagine that a good idea should be create something like a "subcontroller" named Person, almost like a Class.

    I am really lost. Need some guidance.


    In reply to I need wisdom on structuring procedural code in Catalyst by miguelele

    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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.