close
Skip to main content
BERJAYA

r/perl


Announcing DateTime::Lite v0.7.0 - 日本語ドキュメント追加・新機能リリース / Japanese documentation & new features (English follows)
Announcing DateTime::Lite v0.7.0 - 日本語ドキュメント追加・新機能リリース / Japanese documentation & new features (English follows)

Announcing DateTime::Lite v0.7.0 - 日本語ドキュメント追加・新機能リリース / Japanese documentation & new features (English follows)


日本語

Perlコミュニティの皆さん、こんにちは。

DateTime::Lite v0.7.0をCPANにリリースしましたので、お知らせします。

日本語PODドキュメント

今回のリリースの目玉は、すべてのモジュールに日本語のPODドキュメントを追加したことです。

日本語でのPerlコミュニティに少しでも貢献できれば幸いです。日本に25年在住していても間違いの可能性がありますので、ドキュメントの誤りや改善点があれば、是非遠慮なくフィードバックをお寄せください。

新メソッド:extended_aliases

DateTime::Lite::TimeZoneextended_aliases()メソッドを追加しました。これはJST、CET、ESTのようなタイムゾーン略称から、対応するIANA正規タイムゾーン名へのマッピングを返します。

my $aliases = DateTime::Lite::TimeZone->extended_aliases;
# {
#     'JST' => 'Asia/Tokyo',
#     'CET' => 'Europe/Paris',
#     'EST' => 'America/New_York',
#     ...
# }

aliases()と同様に、スカラーコンテキストではハッシュリファレンスを、リストコンテキストではハッシュを返します。

このメソッドにより、単純なオフセット文字列しか返さないDateTime::TimeZone::Catalog::Extendへの依存が不要になります。extended_aliases()はIANA正規ゾーン名を返すため、過去のDST履歴も含めた完全なタイムゾーン情報が利用できます。

コンストラクタの引数バリデーション強化(v0.6.7より)

前回のリリースv0.6.7で、コンストラクタに不明な引数が渡された場合にエラーを返すようになりました。例えば、yearsの代わりにyearを渡すようなタイポが、エラーなしに無視されることがなくなりました。

# 以前は無視されていた(結果が変わらず気づきにくいバグ)
my $dur = DateTime::Lite::Duration->new( year => 1 );  # 'years'の誤り

# 現在はエラーを返す
if( !defined( $dur ) )
{
    warn DateTime::Lite::Duration->error;
    # "Unknown argument passed to DateTime::Lite::Duration->new: 'year'"
}

対象コンストラクタ:DateTime::Lite->new()from_epoch()from_object()from_day_of_year()last_day_of_month()DateTime::Lite::Duration->new()DateTime::Lite::TimeZone->new()

リンク

フィードバック、バグ報告、プルリクエストなどを大歓迎。


English

Hello all,

I am happy to announce the release of DateTime::Lite v0.7.0 on CPAN.

Japanese POD documentation

The main highlight of this release is the addition of Japanese POD documentation for all modules:

I hope this makes DateTime::Lite more accessible to Japanese Perl developers. Feedback on the documentation, corrections, and improvements are very much welcome.

New method: extended_aliases

DateTime::Lite::TimeZone now provides an extended_aliases() method, returning a mapping from timezone abbreviations such as JST, CET, or EST to their corresponding canonical IANA timezone names:

my $aliases = DateTime::Lite::TimeZone->extended_aliases;
# {
#     'JST' => 'Asia/Tokyo',
#     'CET' => 'Europe/Paris',
#     'EST' => 'America/New_York',
#     ...
# }

Like aliases(), it returns a hash reference in scalar context and a hash in list context.

This method supersedes DateTime::TimeZone::Catalog::Extend, which only returned plain UTC offset strings. extended_aliases() returns canonical IANA zone names, giving you access to full timezone information including historical DST data.

Constructor argument validation (since v0.6.7)

Since v0.6.7, all constructors return an error when an unrecognised argument is supplied, rather than silently ignoring it. This catches typos such as year instead of years that previously produced incorrect results with no indication of error:

# Previously silently ignored
my $dur = DateTime::Lite::Duration->new( year => 1 );  # typo for 'years'

# Now returns an error
if( !defined( $dur ) )
{
    warn DateTime::Lite::Duration->error;
    # "Unknown argument passed to DateTime::Lite::Duration->new: 'year'"
}

This covers DateTime::Lite->new(), from_epoch(), from_object(), from_day_of_year(), last_day_of_month(), DateTime::Lite::Duration->new(), and DateTime::Lite::TimeZone->new().

Links

Feedback, bug reports, and pull requests are very welcome.


LPT: When life changes, dashing helps you earn extra income on your terms. Install the app to become a Dasher today!
BERJAYA LPT: When life changes, dashing helps you earn extra income on your terms. Install the app to become a Dasher today!