Skip Menu |

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 23619
Status: resolved
Priority: 0/
Queue: TimeDate

People
Owner: Nobody in particular
Requestors: jlh [...] gmx.ch
Cc:
AdminCc:

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



Subject: Date::Format->language() doesn't work
The docs say that this will work: use Date::Format; Date::Format->language('German'); But that it's considered to be changed to be: use Date::Language; my $d = new Date::Language('German'); $d->time2str(blah, blah); This change has been made already, but without adapting the docs.
On Sat Nov 25 19:26:58 2006, jlh wrote: Show quoted text
> The docs say that this will work: > > use Date::Format; > Date::Format->language('German'); > > But that it's considered to be changed to be: > > use Date::Language; > my $d = new Date::Language('German'); > $d->time2str(blah, blah);
I'd suggest a better naming convention, and a newer object syntax... my $xmas = DateTime->now->set(month => 12, day => 25); my $formatter = Date::Language::new('German'); # or my $formatter = Date::Language->new('German'); $language_xmas_string = $formatter->time2str($xmax);
#! c:/cygwin/bin/perl # Christmas in many languages... # See http://www.perladvent.org/2007/7/mod7.pl use warnings; use strict; use DateTime; use Date::Format; use Date::Language; # Undocumented. Used by Date::Format. use Unicode::String qw(utf8 utf16); use CGI qw(header); use CGI::Carp qw(fatalsToBrowser); print header(-type => 'text/plain', -charset => 'utf8' ); my $xmas = DateTime->now->set( month => 12, day => 25 ); my @languages = qw(Austrian Brazilian Czech Danish Dutch English Finnish French German Greek Italian Norwegian Swedish); for my $language (sort @languages) { # Date::Format->language($language); my $formatter = Date::Language->new($language); my $lang_string = $formatter->time2str( "%B %e %Y", $xmas->epoch ); my $utf8_string = utf8($lang_string); printf "[%s] %s\n", $language, $utf8_string; }