[Bast-commits] r5927 -
DBIx-Class/0.08/branches/subclassed_rsset/lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Apr 21 10:42:14 GMT 2009
Author: ribasushi
Date: 2009-04-21 11:42:14 +0100 (Tue, 21 Apr 2009)
New Revision: 5927
Modified:
DBIx-Class/0.08/branches/subclassed_rsset/lib/DBIx/Class/Schema.pm
Log:
Clarify _register_source code, no functional changes
Modified: DBIx-Class/0.08/branches/subclassed_rsset/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/subclassed_rsset/lib/DBIx/Class/Schema.pm 2009-04-21 09:57:03 UTC (rev 5926)
+++ DBIx-Class/0.08/branches/subclassed_rsset/lib/DBIx/Class/Schema.pm 2009-04-21 10:42:14 UTC (rev 5927)
@@ -1268,24 +1268,26 @@
my ($self, $moniker, $source, $params) = @_;
my $orig_source = $source;
+
$source = $source->new({ %$source, source_name => $moniker });
+ $source->schema($self);
+ weaken($source->{schema}) if ref($self);
+ my $rs_class = $source->result_class;
+
+
my %reg = %{$self->source_registrations};
$reg{$moniker} = $source;
$self->source_registrations(\%reg);
- $source->schema($self);
- weaken($source->{schema}) if ref($self);
return if ($params->{extra});
- if ($source->result_class) {
- my %map = %{$self->class_mappings};
- if (exists $map{$source->result_class} && $orig_source ne $source->result_class->result_source_instance) {
- warn $source->result_class . ' already has a source, use register_extra_source for additional sources';
- }
- $map{$source->result_class} = $moniker;
- $self->class_mappings(\%map);
+ my %map = %{$self->class_mappings};
+ if (exists $map{$rs_class} and $rs_class->result_source_instance ne $orig_source) {
+ carp "$rs_class already has a source, use register_extra_source for additional sources";
}
+ $map{$rs_class} = $moniker;
+ $self->class_mappings(\%map);
}
sub _unregister_source {
More information about the Bast-commits
mailing list