Changeset 32585


Ignore:
Timestamp:
2018-11-08T17:44:19+13:00 (5 years ago)
Author:
ak19
Message:

Super call in destructor. More important if subclassing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/gssql.pm

    r32584 r32585  
    4343
    4444# TODO: drop table if exists and create table if exists are available in MySQL. Use those cmds
    45 # instead of always first checking for existence ourselves?
     45# instead of always first checking for existence ourselves? Only when subclassing to specific
     46# mysql class.
    4647##############################
    4748
     
    139140sub DESTROY {
    140141    my $self = shift;
    141 
     142   
    142143    if (${^GLOBAL_PHASE} eq 'DESTRUCT') {
    143144   
     
    165166    return;
    166167    }
     168
     169    # "Always include a call to $self->SUPER::DESTROY in our destructors (even if we don't yet have any base/parent classes). (p. 145)"
     170    # Superclass and destroy, call to SUPER: https://www.perlmonks.org/?node_id=879920
     171    # also covers multiple-inheritance (MI)   
     172    $self->SUPER::DESTROY if $self->can("SUPER::DESTROY");
    167173
    168174}
Note: See TracChangeset for help on using the changeset viewer.