Skip to content

fix: document digest_file_ctx and add DESTROY guard#11

Closed
toddr-bot wants to merge 21 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/fix-docs-and-autoload
Closed

fix: document digest_file_ctx and add DESTROY guard#11
toddr-bot wants to merge 21 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/fix-docs-and-autoload

Conversation

@toddr-bot
Copy link
Copy Markdown

What

Document the digest_file_ctx function in Digest::file POD and add an explicit DESTROY method to Digest.pm to prevent AUTOLOAD interference.

Why

  • digest_file_ctx is exported via @EXPORT_OK but was never documented in the POD — users reading the docs couldn't discover it. The POD also incorrectly stated "3 convenience functions" when 4 are exported.
  • AUTOLOAD without an explicit DESTROY is a classic Perl pitfall: implicit destruction calls route through AUTOLOAD, triggering unnecessary require attempts. Adding sub DESTROY {} is standard practice.

How

  • Added digest_file_ctx documentation to Digest::file POD, matching the existing style for other functions.
  • Added sub DESTROY {} after the AUTOLOAD definition in Digest.pm.
  • Added tests for both: digest_file_ctx return type and content, error handling, and can("DESTROY") check.

Testing

All tests pass (4 files, 28 subtests).


🤖 Generated with Claude Code

toddr and others added 21 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
digest_file_ctx was exported via @EXPORT_OK but never documented in
the POD, making it invisible to users. Add documentation and tests.

Add explicit DESTROY sub to prevent AUTOLOAD from catching implicit
destruction calls — standard Perl best practice when using AUTOLOAD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr-bot
Copy link
Copy Markdown
Author

Superseded by #13, which combines all three improvements (DESTROY guard, Digest::file modernization, digest_file_ctx documentation).

@toddr-bot toddr-bot closed this Apr 22, 2026
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