From: Dagfinn Ilmari Mannsåker Date: Wed, 8 Aug 2012 18:41:32 +0000 (+0100) Subject: Remove pointless DESTROY methods X-Git-Tag: v0.11013_01~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b871c8619c656a40ecae1936f12ec8b45a4c3a1a;p=dbsrgits%2FSQL-Translator.git Remove pointless DESTROY methods You can't break circular references in the destructor when those very references keep the destructor from beeing called in the first place. --- diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index d4caf91..3e7884b 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -759,12 +759,6 @@ Get the SQL::Translator instance that instantiated the parser. has translator => ( is => 'rw' ); -sub DESTROY { - my $self = shift; - undef $_ for values %{ $self->_tables }; - undef $_ for values %{ $self->_views }; -} - 1; =pod diff --git a/lib/SQL/Translator/Schema/Constraint.pm b/lib/SQL/Translator/Schema/Constraint.pm index 1e7ab9f..2be5bbd 100644 --- a/lib/SQL/Translator/Schema/Constraint.pm +++ b/lib/SQL/Translator/Schema/Constraint.pm @@ -477,11 +477,6 @@ around equals => sub { return 1; }; -sub DESTROY { - my $self = shift; - undef $self->{'table'}; # destroy cyclical reference -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index f9610ff..c5bda76 100644 --- a/lib/SQL/Translator/Schema/Field.pm +++ b/lib/SQL/Translator/Schema/Field.pm @@ -566,15 +566,6 @@ around equals => sub { return 1; }; -sub DESTROY { -# -# Destroy cyclical references. -# - my $self = shift; - undef $self->{'table'}; - undef $self->{'foreign_key_reference'}; -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/Index.pm b/lib/SQL/Translator/Schema/Index.pm index 0d8a016..890c1b4 100644 --- a/lib/SQL/Translator/Schema/Index.pm +++ b/lib/SQL/Translator/Schema/Index.pm @@ -229,11 +229,6 @@ around equals => sub { return 1; }; -sub DESTROY { - my $self = shift; - undef $self->{'table'}; # destroy cyclical reference -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index 0fd5c09..e7d0cde 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -202,11 +202,6 @@ around equals => sub { return 1; }; -sub DESTROY { - my $self = shift; - undef $self->{'schema'}; # destroy cyclical reference -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index 442ad91..2c0a3da 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -1036,14 +1036,6 @@ sub fkey_constraints { return wantarray ? @cons : \@cons; } -sub DESTROY { - my $self = shift; - undef $self->{'schema'}; # destroy cyclical reference - undef $_ for @{ $self->{'constraints'} }; - undef $_ for @{ $self->{'indices'} }; - undef $_ for values %{ $self->{'fields'} }; -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/Trigger.pm b/lib/SQL/Translator/Schema/Trigger.pm index a82e306..429e7d8 100644 --- a/lib/SQL/Translator/Schema/Trigger.pm +++ b/lib/SQL/Translator/Schema/Trigger.pm @@ -389,11 +389,6 @@ around equals => sub { return 1; }; -sub DESTROY { - my $self = shift; - undef $self->{'schema'}; # destroy cyclical reference -} - # Must come after all 'has' declarations around new => \&ex2err; diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index 6e2861e..bee761e 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -244,11 +244,6 @@ around equals => sub { return 1; }; -sub DESTROY { - my $self = shift; - undef $self->{'schema'}; # destroy cyclical reference -} - # Must come after all 'has' declarations around new => \&ex2err;