Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:23:52+00:00 2026-05-24T23:23:52+00:00

I am starting learning DBIx::Class and I have a doubt in searching in a

  • 0

I am starting learning DBIx::Class and I have a doubt in searching in a related table:

Consider the following code:

 my $books = $author->search_related('books', { name => 'Titanic' }); 
 my $books = $author->books->search({name => 'Titanic'});

What I want is to only searches for books named ‘Titanic’ by the author in $author.
This two searches return the same resultset?
If yes, what is the best way and why?
If no, what is the difference?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:23:53+00:00Added an answer on May 24, 2026 at 11:23 pm

    search_related is a Resultset method. You’d use that if you had a resultset of Authors and you wanted to get a resultset of all of their books named ‘Titanic’.

    my $books = $schema->resultset('Author')->search({ last_name => 'Smith' })
        ->search_related('books', { name => 'Titanic' });
    

    If $author is a row object, representing one row, then your second line is how you’d search his books.

    my $books = $author->books->search({ name => 'Titanic' });
    

    The distinction between rows and resultsets is one of the core concepts of DBIx::Class. You might want to review the DBIC Manual Intro. #dbix-class on irc.perl.org is usually pretty active so you can find help there as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning python for some time now. While starting this learning python
I'm starting learning JAXB, so my question can be very silly. Now I have
I'm starting learning classes in PHP. I coded that: class User { function getFbId($authtoken)
I'm a starting learning mono, so it's new for me. I have a two
I have starting learning Java and android application development side-by-side. Currently, I a String-array
I am just starting out learning Java, GAE etc. I have started a project
This seems to match the rules I have defined, but I only starting learning
just considering starting to learning python but I have one concern before I invest
I am just starting out learning JavaScript and I have just reach the DOM
I've just starting learning jQuery and AJAX. I'm able to load a local page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.