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

  • SEARCH
  • Home
  • 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 8449717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:47:05+00:00 2026-06-10T10:47:05+00:00

I am working on catalyst to design a front end for a database. I

  • 0

I am working on catalyst to design a front end for a database. I am new to perl and catalyst. I am stuck with one error in the controller.

I want to fetch gene names from one table and pass each gene name to a subroutine gene_name(call a subroutine gene_name) which will perform certain function. I some how fetched the column with gene names but they are in the form of Hash reference to other table. My call to gene_name is not working.

Any idea how to pass the values to the subroutine rather than reference?
My code is as follows:

my @gene_list = $c->model('Gene::GeneTable')->search({      
},{
                column =>[qw/symbol/],
}
);
foreach my $gene (@gene_list){
push @gene_aliases, &gene_name($gene);
}

The error I am getting after executing the code is as follows:

DBIx::Class::ResultSet::find(): Can't bind a reference (MyApp::Model::Gene::GeneTable=HASH(0x7ff6d88b7c58))

UPDATED

My gene_name() subroutine is in another module which I have included in the controller. Now I have changed the for loop(in controller) as following and currently it is passing gene name to gene_name() to fetch aliases(But query remains the same):

foreach my $gene (@gene_list){
push @gene_aliases, &gene_name($gene-> symbol);
}

I am accessing the @gene_aliases in my view file as follows:

[% FOREACH g in gene_aliases -%]
[% g %]
[% END -%]

The above code is fetching hash references instead of names in the page. I am not able to display the gene names on web page.If I give [% g.symbol %] in for loop then the page would be empty with no error message.Hope this would be sufficient information for answering my question. If not I would elaborate on it.

My SQL query is as follows:

Select Symbol from GeneTable;

Thanks in advance

UPDATED2

As I am not a full time programmer, I am asking these questions on the blog. Kindly help me resolve my issues. If in case I have search form which takes gene name from user and this gene name has to be passed to the gene_name() subroutine, how do I pass this (to the controller and how to call the gene_name()). Kindly help me in resolving this issue.
My form in view.tt is as follows:

<form method="post" action "[% c.uri_for('/gene')%]">
<input type="text" name="search_alias">
<input type="submit" name="alias_search" value="Search">
</form>

All my aliases are in the other table called Alias, which is been used in gene_name() subroutine.

  • 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-06-10T10:47:06+00:00Added an answer on June 10, 2026 at 10:47 am

    Either the gene_name() function needs to expect a GeneTable object being passed to it, or you would call it like this: gene_name($gene->symbol).

    Having said that, the Controller does not look like the right place for this, based on what limited information you’ve provided.

    It would make a lot more sense to have gene_name as a method of Gene::GeneTable itself, ie:

    package GeneTable;
    
    ...
    
    sub gene_name {
        my $self = shift;
        my $gene_name = ... # do something with $self->symbol
        $gene_name
    }
    
    ...
    

    So that the ->gene_name method is available to any GeneTable object in any context.

    UPDATE following OP’s initial two comments

    It sounds like gene_name() (which possibly should be called gene_aliases()) is a method of a Gene object. Putting such a conversion into a Controller does not adhere to good MVC philosophy.

    Presumably you have model code somewhere – MyApp/Model/Gene/ most likely – and this sub should exist inside Gene/GeneTable.pm. Then you could use it thus:

    [%- FOREACH g IN gene_list -%]
        [% g.symbol %]<br/><ul>
        [%- FOREACH gn IN g.gene_name -%]
        <li>[% gn %]</li>
        [%- END -%]
        </ul>
    [%- END -%]
    

    in your template, and anywhere else you have a GeneTable object or collection thereof.

    UPDATE #2 Following updated question

    DBIx:Class will return an array of objects when called in list context as you do. Perhaps you need to add some Data::Dumper->Dumper() calls to get a handle on what each step is returning to you.

    I suggest you add the following line immediately after your call to ->search():

    $c->log->debug("gene_list contains: ", Data::Dumper->Dumper(\@gene_list));
    

    …and possibly the equivalent debug for @gene_aliases after you’ve populated that.

    That might give you a clearer picture of what you’re getting back from your search, but I’d hazard a guess you’re getting Gene::GeneTable objects.

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

Sidebar

Related Questions

Working on rewriting the front-end of my site in Coffeescript. I understand how to
Working with H2 I get this error when I try to write a row
Working on an extension that use the new experimental devtools apis. How do you
Working on an old Kohana 2 project and I want to link two models.
Working sample using one Table SELECT t.* FROM ( SELECT TITLE.name, (TITLE.value-TITLE.msp) AS Lower,
Working with box2d and cocos2d, I've calculated two vectors: one is the vector pointing
Working in Scala-IDE, I have a Java library, in which one of the methods
I'm working with DBIx::Class in Catalyst framework. My local goal is to add a
Working on dom html . I want to convert node value to string: $html
Working on a end of the year project for school and chose to create

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.