For databases, both DBIx::Class and Rose::DB support this sort of things in various ways. But, it's not expressed in this fashion, so you'll want to read through all the documentation to find it. Look for words like "prefetch".
My criteria for good software:
Does it work?
Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Let's say that you have a row with a number of child rows in some other table. You might
not be interested in the child rows at all, in which case it's a waste to retrieve them at all
be interested in only one, in which case it should be retrieved when you want it
be interested in all of them, so it's best to retrieve them all immediately.
Both DBIC and RoseDB support the ability for the user to specify how they want to handle those kinds of details. And, this is just one example. You'll need to read the documentation to really get an idea of what's possible.
My criteria for good software:
Does it work?
Can someone else come in, make a change, and be reasonably certain no bugs were introduced?