X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSourceProxy.pm;h=70de112c87e1e3f563ff9b633baceaeebc24b8eb;hb=b83736a7d3235d2f50fe5695550eb3637432d960;hp=62c05642850c12cd24eaf7541245b6d1b7086035;hpb=d009cb7d393292037eff527a9f8bab93860224fb;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSourceProxy.pm b/lib/DBIx/Class/ResultSourceProxy.pm index 62c0564..70de112 100644 --- a/lib/DBIx/Class/ResultSourceProxy.pm +++ b/lib/DBIx/Class/ResultSourceProxy.pm @@ -5,23 +5,19 @@ use strict; use warnings; use base 'DBIx::Class'; -use mro 'c3'; -use Scalar::Util 'blessed'; -use DBIx::Class::_Util 'quote_sub'; +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,15 +25,23 @@ 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} + ); } } -sub add_column { shift->add_columns(@_) } +sub add_column { + DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call; + shift->add_columns(@_) +} sub add_relationship { @@ -49,7 +53,10 @@ sub add_relationship { # legacy resultset_class accessor, seems to be used by cdbi only -sub iterator_class { shift->result_source_instance->resultset_class(@_) } +sub iterator_class { + DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call; + shift->result_source_instance->resultset_class(@_) +} for my $method_to_proxy (qw/ source_info