Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
perl中的Bug';什么是autodie.pm?_Perl - Fatal编程技术网

perl中的Bug';什么是autodie.pm?

perl中的Bug';什么是autodie.pm?,perl,Perl,我期待着: #!/usr/bin/perl use autodie; # autodie in effect here { no autodie; # autodie is not in effect here } # autodie should be in effect here because of the supposedly lexical scope # of autodie, but this doesn't die: open my $i, '<', '/n

我期待着:

#!/usr/bin/perl
use autodie;
# autodie in effect here
{
    no autodie;
    # autodie is not in effect here
}
# autodie should be in effect here because of the supposedly lexical scope
# of autodie, but this doesn't die:
open my $i, '<', '/nonexistent';
我错过了什么,或者你同意autodie中有一个bug吗?我在箱子里什么也没找到


编辑:我现在已经归档了我可以用v5.10.0(Debian x86_64)和ActiveState 5.14.2复制它

尝试错误报告

EDIT我测试了一些:为了在bug修复之前避免问题,您需要再次使用
autodie:

use strict;
use autodie;

do {
    no autodie;
    # ...
} while(0);

use autodie;

open FILE, '<', '/non-existing'; # dies again.
使用严格;
使用自动模具;
做{
无自动模具;
# ...
}而(0);
使用自动模具;

打开文件,概要实际上并没有显示具有词法作用域的指令,但在文档的其他地方多次提到它。这显然是一个错误

问题变成了:这个bug还存在吗

$ perl -E'use autodie; say $autodie::VERSION'
2.1001

$ perl -we'use autodie; { no autodie; } open(my $fh, "<", "nonexistant");'

$ perl -we'use autodie; open(my $fh, "<", "nonexistant");'
Can't open 'nonexistant' for reading: 'No such file or directory' at -e line 1

$ perl -we'{ use autodie; } open(my $fh, "<", "nonexistant");'

可以使用autodie归档bug。

在Perl v5.14.2(x86_64)中得到确认。谢谢,是的,在我寻找一个简单的复制脚本的过程中,我还发现
使用autodie也是一种解决方法。但是忘了把它放在邮局了。
use strict;
use autodie;

do {
    no autodie;
    # ...
} while(0);

use autodie;

open FILE, '<', '/non-existing'; # dies again.
$ perl -E'use autodie; say $autodie::VERSION'
2.1001

$ perl -we'use autodie; { no autodie; } open(my $fh, "<", "nonexistant");'

$ perl -we'use autodie; open(my $fh, "<", "nonexistant");'
Can't open 'nonexistant' for reading: 'No such file or directory' at -e line 1

$ perl -we'{ use autodie; } open(my $fh, "<", "nonexistant");'
$ perl -E'use autodie; say $autodie::VERSION'
2.10

$ perl -we'use autodie; { no autodie; } open(my $fh, "<", "nonexistant");'

$ perl -we'use autodie; open(my $fh, "<", "nonexistant");'
Can't open 'nonexistant' for reading: 'No such file or directory' at -e line 1

$ perl -we'{ use autodie; } open(my $fh, "<", "nonexistant");'