support coderef for relationship_attrs
authorRafael Kitover <rkitover@cpan.org>
Sun, 9 Sep 2012 01:26:38 +0000 (21:26 -0400)
committerRafael Kitover <rkitover@cpan.org>
Sun, 9 Sep 2012 02:41:03 +0000 (22:41 -0400)
commit7b6a8d73e16b9b33bc8feb216b7bc8428cd7518b
treeaad0f42300ea98720f96461c19be248e25397305
parenta04e5e2cd5adbde04100b3cb0900ba75adc75f99
support coderef for relationship_attrs

Add support for passing a coderef as relationship_attrs and describe
thorougly in the ::Base POD (as well as improve the existing POD for
 it.)

This is the list of parameters:

 * rel_name

 * local_source

 * remote_source

 * local_table

 * local_cols

 * remote_table

 * remote_cols

 * attrs

The hash is passed as a list, not as a hashref.

The coderef must return a hashref of attributes or nothing.

This is thoroughly tested in t/45relationships.t.

I had to add a fallback => 1 to the DBObject.pm stringification
overload, so that eq would work, and this makes the stringification much
more functional.
Changes
lib/DBIx/Class/Schema/Loader/Base.pm
lib/DBIx/Class/Schema/Loader/DBObject.pm
lib/DBIx/Class/Schema/Loader/RelBuilder.pm
t/45relationships.t