Bitten by locales

ethan on 2003-01-14T09:10:32

My work of porting Mail::Transport::Dbx to as many platforms as possible (and I have access to) is still underway. Yesterday I defeated suncc so now I have a new supported compiler (given that one forces suncc to compile ANSI-code using -Xa instead of the odd SunC flavor).

Now on Win32 (that worked surprisingly well, btw, except for one small issue with an unresolved _PerlIO_exportFile symbol) I realized that a couple of my supplied tests are bogus and non-portable:

ok($item->date_received("%a %b %e %H:%M:%S %Y", 25, 1), "Sun Apr 14 00:27:57 2002");

date_received returns a string formatted according to the format string given as first argument. It uses strftime(3). The string returned will naturally be locales-aware and it's unlikely that everyone is using the same locales-settings as I do.

I already changed date_received() prior the first release where I internally used localtime(3) instead of the more portable gmtime(3). I wonder that I didn't yet receive a failure report from the cpan-testers. It would be irritating since tests fail even if everything was perfectly alright.

I hope the people on perl-xs@perl.org (I asked them about the PerlIO thing) are quick so I can package a new release.