Skip Menu |

This queue is for tickets about the XML-OPML-SimpleGen CPAN distribution.

Report information
The Basics
Id: 51000
Status: resolved
Priority: 0/
Queue: XML-OPML-SimpleGen

People
Owner: stephenca [...] cpan.org
Requestors: KAPPA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.04
Fixed in: (no value)



Subject: XML::OPML::SimpleGen is locale-specific
Current version generates dates with strftime which depends on system locale setting. This is a patch to temporarily set locale to "C". There's also a test and a manifest regen.
Subject: xml-opml.patch
diff -ruN XML-OPML-SimpleGen-0.04/lib/XML/OPML/SimpleGen.pm /home/kappa/work/XML-OPML-SimpleGen-0.04/lib/XML/OPML/SimpleGen.pm --- XML-OPML-SimpleGen-0.04/lib/XML/OPML/SimpleGen.pm 2008-02-08 13:33:43.000000000 +0300 +++ /home/kappa/work/XML-OPML-SimpleGen-0.04/lib/XML/OPML/SimpleGen.pm 2009-10-31 16:04:59.000000000 +0300 @@ -29,7 +29,7 @@ use warnings; use base 'Class::Accessor'; -use POSIX qw(strftime); +use POSIX qw(strftime setlocale LC_TIME); __PACKAGE__->mk_accessors(qw|groups xml_options outline group xml_head xml_outlines xml|); @@ -76,11 +76,13 @@ my $self = bless $args, $class; + my $old_loc = setlocale(LC_TIME, 'C'); $self->head( title => '', dateCreated => strftime( "%a, %e %b %Y %H:%M:%S %z", localtime ), dateModified => strftime( "%a, %e %b %Y %H:%M:%S %z", localtime ), ); + setlocale($old_loc); return $self; } diff -ruN XML-OPML-SimpleGen-0.04/MANIFEST /home/kappa/work/XML-OPML-SimpleGen-0.04/MANIFEST --- XML-OPML-SimpleGen-0.04/MANIFEST 2008-02-07 17:28:24.000000000 +0300 +++ /home/kappa/work/XML-OPML-SimpleGen-0.04/MANIFEST 2009-10-31 16:06:39.000000000 +0300 @@ -1,11 +1,12 @@ Changes -MANIFEST -META.yml # Will be created by "make dist" +lib/XML/OPML/SimpleGen.pm Makefile.PL +MANIFEST +META.yml # Will be created by "make dist" README -lib/XML/OPML/SimpleGen.pm t/00-load.t t/01-func.t t/02-parse.t -t/pod.t +t/03-localefix.t t/pod-coverage.t +t/pod.t diff -ruN XML-OPML-SimpleGen-0.04/t/03-localefix.t /home/kappa/work/XML-OPML-SimpleGen-0.04/t/03-localefix.t --- XML-OPML-SimpleGen-0.04/t/03-localefix.t 1970-01-01 03:00:00.000000000 +0300 +++ /home/kappa/work/XML-OPML-SimpleGen-0.04/t/03-localefix.t 2009-10-31 16:05:43.000000000 +0300 @@ -0,0 +1,14 @@ +#!perl -T +use Test::More tests => 2; +use POSIX qw/setlocale LC_ALL/; + +BEGIN { + use_ok( 'XML::OPML::SimpleGen' ); +} + +setlocale(LC_ALL, "ru_RU.utf8"); + +my $data = XML::OPML::SimpleGen->new()->as_string; + +like($data, qr/<dateCreated>[a-z]{3}, \d+ [a-z]{3} \d{4} \d\d:\d\d:\d\d/i); +#was <dateCreated>Сбт, 31 Окт 2009 15:51:22 +0300</dateCreated>
This issue is closed in v0.05. Many thanks.