Hi fellow Perl hackers, I am working on a large application in which I use DBIX::Class as an ORM. I have a 'Document' resultset that is linked up to a large number of other resultsets using many_to_many relations. This allows me to define what documents are related to other database objects. Now I want to get a list of Documents, easy:
my $documents = $schema->resultset('Document')->search();
For every document that is returned I want to display to which other objects it is actually connected using a many_to_many relation without manually having to go through all the many_to_many relations the object has. This allows me to more easily expand the number of objects the 'Document' object is connected to without having to redefine the code above. Can anyone tell me if it is possible to list which many_to_many relations a resultset has and which relations actually have a connected object?
while (my $document = $documents->next) { my $related_objects = $document->HOW_DO_I_DO_THIS(); ... }
If anyone can help me I would be VERY gratefull
--
Cheers,
Rob

In reply to list DBIX::Class many_to_many relations by misterb101

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.