ethrbunny has asked for the wisdom of the Perl Monks concerning the following question:
Is the object reference passed in when DESTROY is called? IE can I rely on 'my $self = shift;' being valid?
What Im hoping to achieve is to clean up a database handle in the destructor. I have the 'DBH' saved as a member variable and would like to be able to clear it as such.
Is that valid?
What Im hoping to achieve is to clean up a database handle in the destructor. I have the 'DBH' saved as a member variable and would like to be able to clear it as such.
sub DESTROY { my $self = shift; $self->{ 'dbh' }->disconnect(); }
Is that valid?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: cleaning up in DESTROY
by liz (Monsignor) on Apr 03, 2008 at 13:35 UTC | |
Re: cleaning up in DESTROY
by mr_mischief (Monsignor) on Apr 03, 2008 at 16:19 UTC | |
Re: cleaning up in DESTROY
by samtregar (Abbot) on Apr 03, 2008 at 17:27 UTC | |
Re: cleaning up in DESTROY
by Fletch (Bishop) on Apr 03, 2008 at 13:30 UTC | |
by pysome (Scribe) on Apr 05, 2008 at 10:36 UTC |
Back to
Seekers of Perl Wisdom