[Dbix-class] Knowing the correct alias

Eden Cardim edencardim at gmail.com
Tue Nov 23 15:17:45 GMT 2010


>>>>> "Bill" == Bill Moseley <moseley at hank.org> writes:
    Bill> Would it be safe to use the resultset's current alias?

    Bill> sub limit_by_id {
    Bill>     my ($rs , $id ) = @_;

    Bill>     my $alias = $rs->{attrs}{alias};
    Bill>     return $rs->search({ "$alias.id" => $id } );
    Bill> }

Yes, there's a method for that though, $rs->current_source_alias

-- 
     Eden Cardim            Need help with your perl Catalyst or DBIx::Class project?
   Software Engineer                   http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.        Want a managed development or deployment platform?
http://blog.edencardim.com             http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list