在perl的autodie.pm错误?

前端之家收集整理的这篇文章主要介绍了在perl的autodie.pm错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我期待:
#!/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';

我基于perldoc autodie说:

The “autodie” pragma has lexical scope,meaning that functions and
subroutines altered with “autodie” will only change their behavIoUr
until the end of the enclosing block,file,or “eval”

此外,{no autodie}(在范围内)甚至是SYNOPSIS的一部分

使用/无警告的行为,如我所料:

#!/usr/bin/perl
use warnings;
{
    no warnings;
}
# This *does* generate a warning
print undef;

我错过了什么或者你同意在autodie有一个错误?我在autodie buglist没有找到什么

This is perl,v5.10.1 (*) built for i486-linux-gnu-thread-multi

编辑:我现在提交a bug report

解决方法

我可以用v5.10.0(Debian x86_64)和ActiveState 5.14.2重现这个。

尝试this location错误报告。

编辑我测试了一些:绕过问题,直到bug被修复,你将需要再次使用autodie:

use strict;
use autodie;

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

use autodie;

open FILE,'/non-existing'; # dies again.
原文链接:https://www.f2er.com/Perl/173347.html

猜你在找的Perl相关文章