使用区域设置 - 问题

sid*_*com 2 perl locale pragma

当我设置localeit_IT.UTF-8(导出LC_ALL = it_IT.UTF-8)并运行此脚本时

#!/usr/bin/env perl
use warnings;
use 5.012;
use POSIX qw(strftime);

say strftime "%A %B %e %H:%M:%S %Y", localtime;
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

martedì marzo 15 08:50:07 2011
Run Code Online (Sandbox Code Playgroud)

但阅读本文(来自The-use-locale-pragma):

By default, Perl ignores the current locale. The use locale pragma tells Perl to use the current locale for some operations: ... The POSIX date formatting function (strftime()) uses LC_TIME .

为什么我的语言环境设置会对strftime-output产生影响而不使用localepragma?

Sch*_*ern 5

POSIX::strftime是真正的strftimeC函数调用的一个薄包装器,time.h它使用当前的语言环境.Perl没有通过努力使其符合.

DateTime具有在Perl中实现的strftime等效项,它将符合Perl的locale pragma.