SQL を DBIC でうまく使う

DBIC Custom ResultSource for Arbitrary SQL

So you haven't figured out how to write a complex query in DBIC yet? No worries, DBIC will allow you to write that query in SQL. To do so one:

  • Defines a custom ResultSource based on an existing one.
  • Pass the new ResultSource's name method the raw SQL.
  • Register the new ResultSource with your Schema.

こんな方法は知らなかった。あとでやってみる。

Cookbook にも載ってた。