misterb101 has asked for the wisdom of the Perl Monks concerning the following question:

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