Skip to content

fix: use instance DOCUMENT class instead of package global (GH #173)#377

Draft
toddr-bot wants to merge 1 commit intoabw:masterfrom
toddr-bot:koan.toddr.bot/fix-provider-document-class
Draft

fix: use instance DOCUMENT class instead of package global (GH #173)#377
toddr-bot wants to merge 1 commit intoabw:masterfrom
toddr-bot:koan.toddr.bot/fix-provider-document-class

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

Summary

  • What: Fix Provider to use $self->{DOCUMENT} instead of the package global $DOCUMENT when constructing document objects from parsed templates.
  • Why: When a custom DOCUMENT class is passed to the Provider constructor, it was stored in $self->{DOCUMENT} but never used for ->new() — the global $DOCUMENT was called instead, silently ignoring the custom class. The same method already uses $self->{DOCUMENT} for write_perl_file(), making this inconsistency clear.
  • How: One-line fix on line 927 of Provider.pm. Added test in provider.t that creates a Provider with a custom DOCUMENT class and verifies fetch() returns objects of that class.

Closes #173

Test plan

  • New test: custom DOCUMENT class creates instances of the right type
  • Full test suite passes (2917 tests)

🤖 Generated with Claude Code

Provider._store() used $self->{DOCUMENT} for write_perl_file() but
the same method used the package global $DOCUMENT for new(). This
meant a custom DOCUMENT class passed to the Provider constructor
was silently ignored when creating document objects from parsed
templates.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.

When creating a new document Provider uses global DOCUMENT instead of self's [rt.cpan.org #57206]

1 participant