Skip to content

fix: add AUTOLOAD DESTROY guard, document digest_file_ctx#26

Draft
toddr-bot wants to merge 4 commits into
mainfrom
koan.toddr.bot/modernize-and-fix-autoload
Draft

fix: add AUTOLOAD DESTROY guard, document digest_file_ctx#26
toddr-bot wants to merge 4 commits into
mainfrom
koan.toddr.bot/modernize-and-fix-autoload

Conversation

@toddr-bot

Copy link
Copy Markdown

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

  • AUTOLOAD DESTROY guard: Without an explicit sub DESTROY {}, Perl's garbage collection triggers AUTOLOAD, which attempts Digest->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.
  • digest_file_ctx undocumented: The function is exported via @EXPORT_OK but has no POD documentation, making it invisible to users reading the docs. The POD also incorrectly states "3 convenience functions" when there are 4.
  • Digest::file @isa modernization: Replace manual use Exporter (); @ISA = ... with use base 'Exporter' for clarity. Uses base (not parent) to preserve Perl 5.006 compatibility.

How

  • Added empty sub DESTROY {} in Digest.pm after AUTOLOAD
  • Replaced @ISA assignment with use base 'Exporter' in Digest::file
  • Added =item digest_file_ctx(...) to the POD with full documentation
  • Fixed function count in POD ("3" → "4")

Testing

  • Added test in t/digest.t: verifies Digest has explicit DESTROY method
  • Added tests in t/file.t: digest_file_ctx() returns correct class, feeds file content, croaks on missing file
  • All existing tests continue to pass

Also exists as gisle#13 (upstream).

🤖 Generated with Claude Code

toddr-bot and others added 2 commits April 15, 2026 08:52
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>
toddr-bot and others added 2 commits July 15, 2026 02:55
Docker Hub deprecated Image Format v1, breaking pulls for perl:5.8
through perl:5.24 containers on GitHub Actions. This caused all CI
runs (including main branch) to fail on those versions.

- Remove Perl 5.8-5.24 from matrix (Docker images no longer pullable)
- Add Perl 5.34, 5.36, 5.38, 5.40 to matrix
- Update actions/checkout from v2 to v4

The module still supports Perl 5.006+ at runtime; only CI coverage
of versions older than 5.26 is affected by this infrastructure change.

Supersedes #14 and #15.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consolidates CI improvements into a single change:
- Remove Perl 5.8–5.24 from matrix (Docker Hub deprecated Image Format v1)
- Add Perl 5.34, 5.36, 5.38, 5.40 to linux matrix
- Update actions/checkout v2 → v4 (Node.js 12 → 20)
- Add Windows CI job using Strawberry Perl

Supersedes #14, #15, #18, and #20.

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.

1 participant