Skip to content

fix: strftime class method uses wrong package for language dispatch#137

Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-strftime-bless-package
Draft

fix: strftime class method uses wrong package for language dispatch#137
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-strftime-bless-package

Conversation

@Koan-Bot
Copy link
Copy Markdown

@Koan-Bot Koan-Bot commented May 6, 2026

What

Fix strftime() to produce language-specific output when called as a class method on Date::Language subclasses.

Why

strftime() used bless [] (no package argument), so class method calls like Date::Language::German->strftime(...) always produced English day/month names instead of German ones. The object was blessed into Date::Format::Generic — the compilation package — instead of the calling package, breaking method dispatch for format_a, format_b, etc.

The sister method time2str() already had the correct bless [], $pkg form.

How

One-character fix: bless []bless [], $pkg in Generic.pm line 47 — matching what time2str() 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

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>
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