Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: The (Too-)Well Hidden Magic of "DBIx::Class"

by dragonchild (Archbishop)
on Feb 05, 2009 at 01:53 UTC ( #741476=note: print w/replies, xml ) Need Help??


in reply to The (Too-)Well Hidden Magic of "DBIx::Class"

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?
  • Comment on Re: The (Too-)Well Hidden Magic of "DBIx::Class"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://741476]
help
Chatterbox?
[GotToBTru]: I
[GotToBTru]: ve been looking at a document we have been sending to a customer for years now
[MidLifeXis]: We don't, at least in this case ;-)
[GotToBTru]: and it includes a reference number that I didnt recognize
[GotToBTru]: I had to dig into the code to find out where it came from .. and it makes no sense
[GotToBTru]: so I emailed my contact asking if we could just stop sending it .. I'm afraid she is going to ask "what is that anyway?"
[MidLifeXis]: heh.
[MidLifeXis]: Most likely it is a code that some undocumented system, hidden behind layers of IT, deep in the bowels of the building under the machine room floor, reads that code to keep a presence switch from going off. :-b

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-01-20 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (176 votes). Check out past polls.