Skip to content

fix: add DESTROY guard, modernize Digest::file, document digest_file_ctx#13

Draft
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/modernize-and-fix-autoload
Draft

fix: add DESTROY guard, modernize Digest::file, document digest_file_ctx#13
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/modernize-and-fix-autoload

Conversation

@toddr-bot
Copy link
Copy Markdown

What

Three small housekeeping fixes combined into one PR (recovered from two orphan branches).

Why

  • AUTOLOAD DESTROY: Without an explicit DESTROY, Perl's garbage collector triggers AUTOLOAD on every Digest object destruction, attempting Digest->new("DESTROY") — wasted work and potential for confusing error messages.
  • use parent: Digest::file was the last module using @ISA = qw(Exporter) instead of use parent. Modernizing for consistency with the rest of the Perl ecosystem.
  • digest_file_ctx docs: The function was exported in @EXPORT_OK but missing from POD — invisible to users reading documentation.

How

  • Added empty sub DESTROY { } to Digest.pm (standard Perl practice for any class with AUTOLOAD)
  • Replaced use Exporter (); our @ISA = qw(Exporter) with use parent 'Exporter' in Digest::file
  • Added digest_file_ctx to the POD =over list with full description

Testing

  • Added can("DESTROY") assertion in t/digest.t
  • Added digest_file_ctx functional tests + error handling test in t/file.t
  • All existing tests pass (9 test files, all green)

🤖 Generated with Claude Code

toddr and others added 22 commits October 6, 2020 09:56
- meta-spec 2 resources format
- dependencies are static, set dynamic_config 0
- EUMM will set configure_requires on itself
- Test::More only used in tests
- boilerplate to clean out unsupported keys if installed with old EUMM
Makefile.PL - use meta-spec 2, fix prereqs, compatibility with old EUMM
base.t, file.t: unlink temporary files created during testing
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants