fix: add AUTOLOAD DESTROY guard, document digest_file_ctx#26
Draft
fix: add AUTOLOAD DESTROY guard, document digest_file_ctx#26
Conversation
Add empty DESTROY to Digest.pm to prevent AUTOLOAD from catching implicit DESTROY calls during garbage collection. Replace @isa with use parent in Digest::file — the last module still using the legacy pattern. Document digest_file_ctx() in POD — it was exported but undocumented. Add tests for both changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
parent.pm was added in 5.10.1 but MIN_PERL_VERSION is 5.006. base.pm is available since 5.004005 and consistent with Digest::base's own POD example. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a DESTROY guard to prevent AUTOLOAD from catching implicit garbage collection calls, modernize Digest::file's Exporter usage, and document the exported-but-undocumented
digest_file_ctx()function.Why
sub DESTROY {}, Perl's garbage collection triggers AUTOLOAD, which attemptsDigest->new("DESTROY")— a silent failure that can produce confusing error messages in edge cases. This is a well-known Perl best practice for any AUTOLOAD implementation.@EXPORT_OKbut has no POD documentation, making it invisible to users reading the docs. The POD also incorrectly states "3 convenience functions" when there are 4.use Exporter (); @ISA = ...withuse base 'Exporter'for clarity. Usesbase(notparent) to preserve Perl 5.006 compatibility.How
sub DESTROY {}in Digest.pm after AUTOLOAD@ISAassignment withuse base 'Exporter'in Digest::file=item digest_file_ctx(...)to the POD with full documentationTesting
digest_file_ctx()returns correct class, feeds file content, croaks on missing fileAlso exists as gisle#13 (upstream).
🤖 Generated with Claude Code