Skip to content
Snippets Groups Projects
Commit 4da57a10 authored by Leo Gordon's avatar Leo Gordon
Browse files

weaken the link back from the object back to the adaptor

parent 595d9e36
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
package Bio::EnsEMBL::Hive::AnalysisCtrlRule; package Bio::EnsEMBL::Hive::AnalysisCtrlRule;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Hive::URLFactory; use Bio::EnsEMBL::Hive::URLFactory;
use Bio::EnsEMBL::Hive::Extensions; use Bio::EnsEMBL::Hive::Extensions;
use Bio::EnsEMBL::Utils::Argument; use Bio::EnsEMBL::Utils::Argument;
...@@ -76,9 +78,14 @@ sub new { ...@@ -76,9 +78,14 @@ sub new {
} }
sub adaptor { sub adaptor {
my ( $self, $adaptor ) = @_; my $self = shift @_;
$self->{'_adaptor'} = $adaptor if defined $adaptor;
return $self->{'_adaptor'}; if(@_) {
$self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
}
return $self->{'_adaptor'};
} }
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
package Bio::EnsEMBL::Hive::AnalysisJob; package Bio::EnsEMBL::Hive::AnalysisJob;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()' use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()'
use Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor; use Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor; use Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor;
...@@ -58,11 +60,17 @@ sub new { ...@@ -58,11 +60,17 @@ sub new {
} }
sub adaptor { sub adaptor {
my $self = shift; my $self = shift @_;
$self->{'_adaptor'} = shift if(@_);
return $self->{'_adaptor'}; if(@_) {
$self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
}
return $self->{'_adaptor'};
} }
sub dbID { sub dbID {
my $self = shift; my $self = shift;
$self->{'_dbID'} = shift if(@_); $self->{'_dbID'} = shift if(@_);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package Bio::EnsEMBL::Hive::AnalysisStats; package Bio::EnsEMBL::Hive::AnalysisStats;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Analysis; use Bio::EnsEMBL::Analysis;
use Bio::EnsEMBL::DBSQL::DBAdaptor; use Bio::EnsEMBL::DBSQL::DBAdaptor;
...@@ -44,12 +45,19 @@ sub new { ...@@ -44,12 +45,19 @@ sub new {
return $self; return $self;
} }
sub adaptor { sub adaptor {
my $self = shift; my $self = shift @_;
$self->{'_adaptor'} = shift if(@_);
return $self->{'_adaptor'}; if(@_) {
$self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
}
return $self->{'_adaptor'};
} }
sub refresh { sub refresh {
my $self = shift; my $self = shift;
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
package Bio::EnsEMBL::Hive::DataflowRule; package Bio::EnsEMBL::Hive::DataflowRule;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()' use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()'
use Bio::EnsEMBL::Utils::Exception; use Bio::EnsEMBL::Utils::Exception;
use Bio::EnsEMBL::Hive::DBSQL::AnalysisAdaptor; use Bio::EnsEMBL::Hive::DBSQL::AnalysisAdaptor;
...@@ -112,12 +114,15 @@ sub dbID { ...@@ -112,12 +114,15 @@ sub dbID {
sub adaptor { sub adaptor {
my $self = shift @_; my $self = shift @_;
if(@_) { # setter mode if(@_) {
$self->{'_adaptor'} = shift @_; $self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
} }
return $self->{'_adaptor'}; return $self->{'_adaptor'};
} }
=head2 branch_code =head2 branch_code
Function: getter/setter method for the branch_code of the dataflow rule Function: getter/setter method for the branch_code of the dataflow rule
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
package Bio::EnsEMBL::Hive::NakedTable; package Bio::EnsEMBL::Hive::NakedTable;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()' use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()'
sub new { sub new {
...@@ -37,15 +39,19 @@ sub new { ...@@ -37,15 +39,19 @@ sub new {
return $self; return $self;
} }
sub adaptor { sub adaptor {
my $self = shift @_; my $self = shift @_;
if(@_) { if(@_) {
$self->{'_adaptor'} = shift @_; $self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
} }
return $self->{'_adaptor'}; return $self->{'_adaptor'};
} }
sub table_name { sub table_name {
my $self = shift @_; my $self = shift @_;
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
package Bio::EnsEMBL::Hive::ResourceDescription; package Bio::EnsEMBL::Hive::ResourceDescription;
use strict; use strict;
use Scalar::Util ('weaken');
use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()' use Bio::EnsEMBL::Utils::Argument; # import 'rearrange()'
sub new { sub new {
...@@ -46,15 +48,19 @@ sub new { ...@@ -46,15 +48,19 @@ sub new {
return $self; return $self;
} }
sub adaptor { sub adaptor {
my $self = shift @_; my $self = shift @_;
if(@_) { if(@_) {
$self->{'_adaptor'} = shift @_; $self->{'_adaptor'} = shift @_;
weaken $self->{'_adaptor'};
} }
return $self->{'_adaptor'}; return $self->{'_adaptor'};
} }
sub rc_id { sub rc_id {
my $self = shift @_; my $self = shift @_;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment