[Bast-commits] r5063 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat
schwern at dev.catalyst.perl.org
schwern at dev.catalyst.perl.org
Thu Nov 6 12:44:27 GMT 2008
Author: schwern
Date: 2008-11-06 12:44:27 +0000 (Thu, 06 Nov 2008)
New Revision: 5063
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
Log:
mk_group_accessor() is sometimes called internally when inflating a column
and with an array ref field spec, but the accessor and column names are
the same. Special case that to go through the usual accessor_name_for stuff.
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/AccessorMapping.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/AccessorMapping.pm 2008-11-06 11:05:52 UTC (rev 5062)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/AccessorMapping.pm 2008-11-06 12:44:27 UTC (rev 5063)
@@ -11,7 +11,7 @@
my($accessor, $col) = ref $col ? @$col : (undef, $col);
my($ro_meth, $wo_meth);
- if( defined $accessor ) {
+ if( defined $accessor and ($accessor ne $col)) {
$ro_meth = $wo_meth = $accessor;
}
else {
@@ -21,13 +21,14 @@
# warn "class: $class / col: $col / ro: $ro_meth / wo: $wo_meth\n";
if ($ro_meth eq $wo_meth or # they're the same
- $wo_meth eq $col) # or only the accessor is custom
- {
- $class->next::method($group => [ $ro_meth => $col ]);
- } else {
- $class->mk_group_ro_accessors($group => [ $ro_meth => $col ]);
- $class->mk_group_wo_accessors($group => [ $wo_meth => $col ]);
- }
+ $wo_meth eq $col) # or only the accessor is custom
+ {
+ $class->next::method($group => [ $ro_meth => $col ]);
+ }
+ else {
+ $class->mk_group_ro_accessors($group => [ $ro_meth => $col ]);
+ $class->mk_group_wo_accessors($group => [ $wo_meth => $col ]);
+ }
}
}
More information about the Bast-commits
mailing list