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
Download (untitled) / with headers
text/plain 285b
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.
Download (untitled) / with headers
text/plain 558b
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);
Download xmas.pl
text/x-perl 896b
#! 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; }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.