fix: strftime class method uses wrong package for language dispatch#137
Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: strftime class method uses wrong package for language dispatch#137Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
strftime() used 'bless []' without specifying the package, causing class method calls like Date::Language::German->strftime(...) to always produce English output. The object was blessed into Date::Format::Generic instead of the calling package, so method dispatch resolved format_a/format_b/etc. to English formatters. Fix: change 'bless []' to 'bless [], $pkg' — matching what time2str() already does correctly on the adjacent line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fix
strftime()to produce language-specific output when called as a class method onDate::Languagesubclasses.Why
strftime()usedbless [](no package argument), so class method calls likeDate::Language::German->strftime(...)always produced English day/month names instead of German ones. The object was blessed intoDate::Format::Generic— the compilation package — instead of the calling package, breaking method dispatch forformat_a,format_b, etc.The sister method
time2str()already had the correctbless [], $pkgform.How
One-character fix:
bless []→bless [], $pkginGeneric.pmline 47 — matching whattime2str()does on line 77.Testing
Added
t/strftime-lang.t— verifies both object and class method calls produce correct language output for German and French. Full suite passes on all Perl versions.🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 49 insertions(+), 1 deletion(-)
Code scan: clean
Tests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline