关于 Unicode的CWD模块是否不是最新的,或者 abs_path 是否应该仅在写入操作系统时使用?
#!/usr/bin/env perl
use warnings;
use 5.012;
use utf8;
binmode STDOUT, ':encoding(utf-8)';
use Cwd qw(abs_path);
use File::Spec::Functions qw(rel2abs);
chdir '/tmp';
my $file = "Hello \x{263a}";
open my $fh, '>', $file or die $!;
say $fh 'test';
close $fh;
say abs_path $file;
say rel2abs $file;
输出:
# /tmp/Hello âº
# /tmp/Hello ☺