加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在perl中使用glob()仍然存在不可预测的行为吗?

发布时间:2020-12-15 21:57:00 所属栏目:大数据 来源:网络整理
导读:我从2000年的聊天板中引用了PerlFaq中的这段智慧. Is there a leak/bug in glob()? Due to the current implementation on some operating systems,when you use the glob() function or its angle-bracket alias in a scalar context,you may cause a leak
我从2000年的聊天板中引用了PerlFaq中的这段智慧.

Is there a leak/bug in glob()?

Due to the current implementation on some operating systems,when you
use the glob() function or its angle-bracket alias in a scalar
context,you may cause a leak and/or unpredictable behavior. It’s best
therefore to use glob() only in list context.

我读到这个问题在Perl 5.6中得到修复,但后来听到一个报告,它仍然出现在5.10.1中

有没有人对最近的问题有任何经验,哪里有最好的地方找到关于此的确定答案?

[稍后..]最新的PerlFAQ说:

5.18: Is there a leak/bug in glob()?

(contributed by brian d foy)

Starting with Perl 5.6.0,“glob” is implemented internally rather than
relying on an external resource. As such,memory issues with “glob”
aren’t a problem in modern perls.

=====

最后:报告的问题是由于在已经给出了所有匹配的项目之后在循环中使用它而滥用了glob.它没有问题.

解决方法

使用Source Luke和Commit History

http://perl5.git.perl.org/perl.git/history/HEAD:/ext/File-Glob

更新:虽然在5.14那个长期过时的perlfaq5项目已经在latest中消失了

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读