【发布时间】:2014-08-20 05:09:19
【问题描述】:
通常你会这样做:
open( my $fh, "+<", "$thefile.txt") or die "Could not open $thefile.txt $!\n";
但是使用 IO::File 你可以(来自文档):
$fh = new IO::File;
if ($fh->open("< file")) {
print <$fh>;
$fh->close;
}
如果打开文件时出现问题,IO::File 是否会自动抛出错误/死机?使用这个模块的时候会怎么做呢?
主要与日志记录有关,您将如何注销“没有这样的文件或目录”之类的“好”错误消息
【问题讨论】: