Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
The big key here is to only use the pieces you actually need to use. Then, when you find yourself bumping against something, then ask how to do that thing, explaining what your'e trying to do. I've been using it on and off for 2 years, doing some really awesome things, and I do some development on it, but I still learn new things every week or so just by hanging out in #dbix-class.

Second, search() does INNER JOINS by default for has_one and belongs_to and LEFT JOINS by default for has_many.

The other piece you might be missing is everything is based on relationships. That's what join and prefetch are all about.

The final magic bit is the idea of the resultset. You can think of a resultset as a family of SQL statements (but it's a lot more than that). You can build resultsets from other resultsets and execute different SQL statements from the same resultset object. The X_related methods call X on the resultset found by the _related() relationship, but bound by the conditions set in the initial resultset. Oh - and you can build resultsets till the cows come home, but you don't actually touch the database until you get a row object.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: The (Too-)Well Hidden Magic of "DBIx::Class" by dragonchild
in thread The (Too-)Well Hidden Magic of "DBIx::Class" by sundialsvc4

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 drinking their drinks and smoking their pipes about the Monastery: (12)
    As of 2014-07-25 13:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (172 votes), past polls