[Bast-commits] r4199 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat
schwern at dev.catalyst.perl.org
schwern at dev.catalyst.perl.org
Fri Mar 14 02:01:21 GMT 2008
Author: schwern
Date: 2008-03-14 02:01:20 +0000 (Fri, 14 Mar 2008)
New Revision: 4199
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/ColumnCase.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/Relationships.pm
Log:
Move has_a() code out of ColumnCase. That should be the last of it.
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/ColumnCase.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/ColumnCase.pm 2008-03-14 01:50:05 UTC (rev 4198)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/ColumnCase.pm 2008-03-14 02:01:20 UTC (rev 4199)
@@ -17,10 +17,12 @@
}
sub has_a {
- my ($class, $col, @rest) = @_;
- $class->next::method(lc($col), @rest);
- $class->mk_group_accessors('inflated_column' => $col);
- return 1;
+ my($self, $col, @rest) = @_;
+
+ $self->_declare_has_a(lc $col, @rest);
+ $self->_mk_inflated_column_accessor($col);
+
+ return 1;
}
sub has_many {
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/Relationships.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/Relationships.pm 2008-03-14 01:50:05 UTC (rev 4198)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/CDBICompat/Relationships.pm 2008-03-14 02:01:20 UTC (rev 4199)
@@ -23,8 +23,19 @@
=cut
sub has_a {
+ my($self, $col, @rest) = @_;
+
+ $self->_declare_has_a($col, @rest);
+ $self->_mk_inflated_column_accessor($col);
+
+ return 1;
+}
+
+
+sub _declare_has_a {
my ($self, $col, $f_class, %args) = @_;
- $self->throw_exception( "No such column ${col}" ) unless $self->has_column($col);
+ $self->throw_exception( "No such column ${col}" )
+ unless $self->has_column($col);
$self->ensure_class_loaded($f_class);
my $rel_info;
@@ -55,10 +66,15 @@
has_a => $col,
$rel_info
);
-
+
return 1;
}
+sub _mk_inflated_column_accessor {
+ my($class, $col) = @_;
+
+ return $class->mk_group_accessors('inflated_column' => $col);
+}
sub has_many {
my ($class, $rel, $f_class, $f_key, $args) = @_;
More information about the Bast-commits
mailing list