autodie-pragma对编码有影响吗?

sid*_*com 16 perl encoding autodie

为什么我得到"autodie"不同的输出?

#!/usr/bin/env perl
use warnings;
use 5.012;
use utf8;
use open ':encoding(utf-8)';
use open ':std';

open my $fh, '>', 'test.txt' or die $!;
say $fh 'käse';
close $fh;

open my $fh1, '<', 'test.txt' or die $!;
while ( my $row = readline( $fh1 ) ) {
    print $row;
}
close $fh1;

use autodie;

open my $fh2, '<', 'test.txt';
while ( my $row = readline( $fh2 ) ) {
    print $row;
}
close $fh2;

# Output:
# käse
# käse
Run Code Online (Sandbox Code Playgroud)

Eri*_*rom 17

除非有人提出更好的理由,否则这看起来就像是与pragma autodie相关的错误open.

更改上次打开以open my $fh2, '<:utf8', 'test.txt';修复系统上的问题.所以这可能是一个临时的工作.

我刚刚检查过RT,这是一个注册的bug:

https://rt.cpan.org/Public/Bug/Display.html?id=54777

看起来它与每个编译指示有关,使用不同的方法重载open函数.