Help!

I am attempting to use join in DBIx::Class. Perl will read the search component, then ignore the join component.

In the Result packages the code reads as follows:

TblPerson:
__PACKAGE__->add_columns( "PID", { data_type => "integer", extra => { unsigned => 1 }, is_auto_increment => 1, is_nullable => 0, }, "FName", { data_type => "varchar", is_nullable => 0, size => 30 }, "MI", { data_type => "char", is_nullable => 1, size => 2 }, "LName", { data_type => "varchar", is_nullable => 0, size => 30 }, "username", { data_type => "varchar", is_nullable => 0, size => 8 }, ); . . . __PACKAGE__->has_many( "tbl_requests", "DB::BSMS::Result::TblRequests", { "foreign.PID" => "self.PID" }, { cascade_copy => 0, cascade_delete => 0 }, );

TblRequests:
__PACKAGE__->add_columns( "RID", { data_type => "integer", extra => { unsigned => 1 }, is_auto_increment => 1, is_nullable => 0, }, "PID", { data_type => "integer", extra => { unsigned => 1 }, is_foreign_key => 1, is_nullable => 0, }, "original_post_date", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, "last_update", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, "submit_date", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "status", { data_type => "varchar", is_nullable => 0, size => 20 }, "sent_email", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, ); . . . __PACKAGE__->belongs_to( "p", "DB::BSMS::Result::TblPerson", { PID => "PID" }, { is_deferrable => 1, on_delete => "NO ACTION", on_update => "NO ACT +ION" }, );

CALLING METHOD:
method get_user_request_status() { my @proc_requests = $schema->resultset( 'TblRequests' )->search({ -or => [ -and => [ -or => [ 'sent_email' => {'!=', undef }, 'sent_email' => {'!=', '0000-00-00'}, ], ], 'status' => 'Offered', 'status' => 'Denied', 'status' => 'Cancelled' 'status' => 'Conditional Offer', ], }, { join => 'p' } ); return \@proc_requests if @proc_requests; } }

When I exclude the the join component, the search component works fine. However, the
moment I introduce the join, the result set only returns data from TblRequests, and nothing from
TblPerson.

I ran debug, and it only displays the $schema statement upto the closing outter -or bracket "],". When
I press 'n' to go to the next line, it bypasses join component and goes right to the return statement. It simply
ignores the join component.

Any thoughts or suggestions? Thanks.


In reply to Problems Using Join in DBIx::Class by phildeman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.