destroy#

Release the native context attached to a Digest::SHA object.

The Perl destructor. Invoked automatically when the last reference to a Digest::SHA object goes out of scope - you do not normally call it yourself. It frees the heap-allocated hashing context behind the blessed reference.

תקציר#

{
    my $sha = Digest::SHA->new(256);
    # ... use $sha ...
}   # DESTROY runs here when $sha leaves scope

מה מוחזר#

Nothing. DESTROY returns to Perl with no value.

דוגמאות#

my $sha = Digest::SHA->new(256);
undef $sha;    # triggers DESTROY
## Double-free safety: explicit DESTROY followed by scope exit is harmless.

my $sha = Digest::SHA->new(256);
$sha->DESTROY;

## automatic DESTROY on scope exit is a no-op after the explicit call

מקרי קצה#

  • Calling DESTROY on an object that is not a blessed Digest::SHA reference is silently ignored.

  • After DESTROY, the object’s internal pointer is zeroed, so repeated calls are safe.

הבדלים מן ה-upstream#

Fully compatible with upstream Digest::SHA 6.04.

ראו גם#

  • new - counterpart: allocates the context that DESTROY releases.

  • clone - each clone also owns a context and is destroyed independently.