DBIx::Classで left outer joinする

-join_typeオプションに'inner|left|right'を渡してあげる。忘れないようにとっても私的メモ。

my $schema = SchemaLoader->connect('...');
$schema->resultset('Members')->search({
      'del_flag'    => { '=', 0 },
},        
{         
    from => [
        { me => 'members'},
        [ 
            { photos => 'photo', -join_type => 'left'},
            { 'me.member_id' => 'photos.member_id' }
        ],
    ],   
    order_by    => "member_id DESC",
}); 


fromの使い方 by Perldoc

    [
        { <alias> => <table>, -join-type => 'inner|left|right' }
        [] # nested JOIN (optional)
        { <table.column> => <foreign_table.foreign_key> }
    ]

    JOIN
        <alias> <table>
        [JOIN ...]
    ON <table.column> = <foreign_table.foreign_key>


joinのネストをする場合、[]内に書いていってサンプル見ただけで頭がゴチャゴチャになるのは私だけでしょうか><


詳しくはATTRIBUTES内のfromの項目を参照です。
http://search.cpan.org/~mstrout/DBIx-Class-0.06000/lib/DBIx/Class/ResultSet.pm#from