From: Brandon Black Date: Tue, 23 May 2006 05:00:09 +0000 (+0000) Subject: Weaken circular references between the loader and the supported schema object X-Git-Tag: 0.03000~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9f1d7b0481d2d19d9c7b2271f64a5fba28d653c;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Weaken circular references between the loader and the supported schema object --- diff --git a/Build.PL b/Build.PL index e3fb102..8d880f0 100644 --- a/Build.PL +++ b/Build.PL @@ -5,6 +5,7 @@ my %arguments = ( license => 'perl', module_name => 'DBIx::Class::Schema::Loader', requires => { + 'Scalar::Util' => 0, 'Data::Dump' => 1.06, 'UNIVERSAL::require' => 0.10, 'Lingua::EN::Inflect' => 1.89, diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 093ce5e..b7304d7 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -8,6 +8,7 @@ use Carp; use UNIVERSAL::require; use Class::C3; use Data::Dump qw/ dump /; +use Scalar::Util qw/ weaken /; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports @@ -93,6 +94,8 @@ sub loader_options { my $class = ref $self || $self; $args{schema} = $self; $args{schema_class} = $class; + weaken($args{schema}) if ref $self; + $self->_loader_args(\%args); $self->_invoke_loader if $self->storage && !$class->loader; @@ -152,6 +155,7 @@ sub clone { $clone->_loader_args($self->_loader_args); $clone->_loader_args->{schema} = $clone; + weaken($clone->_loader_args->{schema}); $clone; }