use Moo; sub artist { $_[0]->artwork->artist } # returns a DBIx obj sub artist_name { $_[0]->artwork->artist->name } # returns a string sub name { $_[0]->artwork->name } # returns a string #### use Moo; sub language { $_[0]->country->language->name } # string #### $rs = $db->resultset('Poem')->search({ 'user.name' => 'tobyink', 'comments.text' => { '!=' => 'bad' }, # DBIx handles this NOT 'country.name' => \'!= country_2.name' # literal SQL for this NOT }, { prefetch => { artwork => [ { artist => 'country' }, { comments => { user => 'country' } }, ], # table aliased here to 'country_2' }, }); #### while ( my $poem = $rs->next ) { say sprintf(q{tobyink doesn't hate "%s" (%s)}, $poem->artwork->name, $poem->artwork->artist->name, ); } #### while ( my $poem = $rs->next ) { say sprintf(q{tobyink doesn't hate "%s" (%s)}, $poem->name, $poem->artist_name, ); } #### if ( $comment->language eq $play->artist->language ) { ... } #### use Moo; sub endpoint_data { return { map { $_ => $_[0]->$_ } qw/only these fields/ }; }