Skip Menu |

This queue is for tickets about the Date-Handler CPAN distribution.

Report information
The Basics
Id: 62897
Status: new
Priority: 0/
Queue: Date-Handler

People
Owner: Nobody in particular
Requestors: phillip.hwong [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: locale warnings when exec "+" op
OS: Ubuntu 10.04 2.6.32-25 Perl Version: 5.10.1 Description: When use "+" op to add two created $date, it will always has locale warning messages. While it still can return the correct summary result. Reproduce steps: 1. As following "http://search.cpan.org/~bbeausej/Date-Handler- 1.2/Handler.pod#Using_Date::Handler::Delta_objects", create the below codes named "date.pl" #!/usr/bin/perl # name: date.pl use strict; use warnings; use Date::Handler; use Date::Handler::Delta; my $delta = new Date::Handler::Delta([1,0,0,0,0,0]); my $date = new Date::Handler({ date => time } ); #$newdate is now one year in the furure. my $newdate = $date+$delta; 2. run it at command line, warnings displayed: phillip@Athen:~/script$ perl date_1.pl Locale en_US does not seem to be implemented on this system, keeping locale Locale en_US does not seem to be implemented on this system, keeping locale Locale en_US does not seem to be implemented on this system, keeping locale 3. display OS locale parameters and modify the code, phillip@Athen:~/script$ locale LANG=zh_CN.utf8 LANGUAGE=zh_CN:zh LC_CTYPE="zh_CN.utf8" LC_NUMERIC="zh_CN.utf8" LC_TIME="zh_CN.utf8" LC_COLLATE="zh_CN.utf8" LC_MONETARY="zh_CN.utf8" LC_MESSAGES="zh_CN.utf8" LC_PAPER="zh_CN.utf8" LC_NAME="zh_CN.utf8" LC_ADDRESS="zh_CN.utf8" LC_TELEPHONE="zh_CN.utf8" LC_MEASUREMENT="zh_CN.utf8" LC_IDENTIFICATION="zh_CN.utf8" LC_ALL= Show quoted text
--------modified codes--------------------- #!/usr/bin/perl use strict; use warnings; use Date::Handler; use Date::Handler::Delta; my $delta = new Date::Handler::Delta({ date=>[1,0,0,0,0,0], time_zone=>'Asia/Shanghai', locale=>'zh_CN.utf8', }); my $date = new Date::Handler({ date=>time, time_zone=>'Asia/Shanghai', locale=>'zh_CN.utf8', }); my $newdate = $date + $delta; ----------------------end---------------------------------- 4. run again: phillip@Athen:~/script$ perl date.pl Locale en_US does not seem to be implemented on this system, keeping locale Locale en_US does not seem to be implemented on this system, keeping locale 5. if add "#" to line:"my $newdate = $date + $delta;", save and run again. no warning messages.
From: phillip.hwong [...] gmail.com
I have wrote a patch to fix above issue. Please verify it.
Subject: locale.patch
--- Handler.pm.original 2010-11-12 16:49:31.817657134 +0800 +++ Handler.pm 2010-11-12 16:42:35.153656643 +0800 @@ -541,7 +541,7 @@ my $epoch = $self->{epoch}; - my $newdate = ref($self)->new({ date => $epoch, time_zone => $self->TimeZone() }); + my $newdate = ref($self)->new({ date => $epoch, time_zone => $self->TimeZone(), locale => $self->Locale() }); my $self_array = $newdate->AsArray(); #Take care of the months. @@ -554,7 +554,7 @@ $self_array->[0] += $years; my $posix_date = ref($self)->new({ date => $self_array, - time_zone => $self->TimeZone(), + time_zone => $self->TimeZone(), locale => $self->Locale() }); if($self->INTUITIVE_MONTH_CALCULATIONS())
From: phillip.hwong [...] gmail.com
PS: in commet #1, "Date::Handler::Delta" should not include locale and timezone defined, it is only related to time date(e.g. years, months,days....).