[Bast-commits] r4741 - DBIx-Class/0.08/trunk/lib/DBIx/Class
lukes at dev.catalyst.perl.org
lukes at dev.catalyst.perl.org
Thu Aug 7 16:24:41 BST 2008
Author: lukes
Date: 2008-08-07 16:24:40 +0100 (Thu, 07 Aug 2008)
New Revision: 4741
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
Log:
reverted back to previous compose_namespace method with minor change
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2008-08-07 01:31:51 UTC (rev 4740)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2008-08-07 15:24:40 UTC (rev 4741)
@@ -616,21 +616,51 @@
=cut
# this might be oversimplified
+# sub compose_namespace {
+# my ($self, $target, $base) = @_;
+
+# my $schema = $self->clone;
+# foreach my $moniker ($schema->sources) {
+# my $source = $schema->source($moniker);
+# my $target_class = "${target}::${moniker}";
+# $self->inject_base(
+# $target_class => $source->result_class, ($base ? $base : ())
+# );
+# $source->result_class($target_class);
+# $target_class->result_source_instance($source)
+# if $target_class->can('result_source_instance');
+# $schema->register_source($moniker, $source);
+# }
+# return $schema;
+# }
+
sub compose_namespace {
my ($self, $target, $base) = @_;
-
my $schema = $self->clone;
- foreach my $moniker ($schema->sources) {
- my $source = $schema->source($moniker);
- my $target_class = "${target}::${moniker}";
- $self->inject_base(
- $target_class => $source->result_class, ($base ? $base : ())
- );
- $source->result_class($target_class);
- $target_class->result_source_instance($source)
- if $target_class->can('result_source_instance');
- $schema->register_source($moniker, $source);
+ {
+ no warnings qw/redefine/;
+# local *Class::C3::reinitialize = sub { };
+ foreach my $moniker ($schema->sources) {
+ my $source = $schema->source($moniker);
+ my $target_class = "${target}::${moniker}";
+ $self->inject_base(
+ $target_class => $source->result_class, ($base ? $base : ())
+ );
+ $source->result_class($target_class);
+ $target_class->result_source_instance($source)
+ if $target_class->can('result_source_instance');
+ $schema->register_source($moniker, $source);
+ }
}
+# Class::C3->reinitialize();
+ {
+ no strict 'refs';
+ no warnings 'redefine';
+ foreach my $meth (qw/class source resultset/) {
+ *{"${target}::${meth}"} =
+ sub { shift->schema->$meth(@_) };
+ }
+ }
return $schema;
}
More information about the Bast-commits
mailing list