Fold column_info() into columns_info()
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSourceProxy.pm
index 94009a5..70de112 100644 (file)
@@ -5,23 +5,19 @@ use strict;
 use warnings;
 
 use base 'DBIx::Class';
-use mro 'c3';
 
-use Scalar::Util 'blessed';
 use DBIx::Class::_Util qw( quote_sub fail_on_internal_call );
 use namespace::clean;
 
 __PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name');
 
-sub get_inherited_ro_instance {  shift->get_inherited(@_) }
+sub get_inherited_ro_instance { $_[0]->get_inherited($_[1]) }
 
 sub set_inherited_ro_instance {
-  my $self = shift;
+  $_[0]->throw_exception ("Cannot set '$_[1]' on an instance")
+    if length ref $_[0];
 
-  $self->throw_exception ("Cannot set @{[shift]} on an instance")
-    if blessed $self;
-
-  $self->set_inherited(@_);
+  $_[0]->set_inherited( $_[1], $_[2] );
 }
 
 
@@ -29,11 +25,16 @@ sub add_columns {
   my ($class, @cols) = @_;
   my $source = $class->result_source_instance;
   $source->add_columns(@cols);
+
+  my $colinfos;
   foreach my $c (grep { !ref } @cols) {
     # If this is an augment definition get the real colname.
     $c =~ s/^\+//;
 
-    $class->register_column($c => $source->column_info($c));
+    $class->register_column(
+      $c,
+      ( $colinfos ||= $source->columns_info )->{$c}
+    );
   }
 }