差不多吧, IO::File 只是一个面向对象的 操作文件 的实现而已
和一般的 open , close 没有任何区别, 第一个方法是用 typeglob 来传递文件句柄, 第2个通过 OOP传递, 我觉得 2个在效率上差不多 2009/12/21 Beckheng Lam <[email protected]> > 第一种方法计算后,对同一文件句柄再进行计算的话,是否需要将文件指针seek到文件头? > > Hong Mayi wrote: > > 现在的问题不是说不能计算md5,两种模式都可以计算,我想确认一下两种模式的区别,还有对硬盘IO的读取和写入利用的频繁程 > 度,我在确认问题出现的地方,如果确实是 IO::File 对硬盘造成大量的读写导致的 read-only system > 错误,我就要换个方式来处理这个问题了,比如用第一种方法或者其他方式 > > > 我现在不能确定换了第一种方法是否可以减少对文件系统的 IO 使用 > > 2009/12/21 Qiang (James) <[email protected]> > >> Hong Mayi wrote: >> > Dear all >> > Digest::MD5->new->addfile(*FILE) >> > >> > 和 >> > >> > Digest::MD5->new->addfile(IO::File->new($file)) >> > >> > 有什么区别? >> > >> > 我用第二种算法,linux 机器经常出现 read only system 的错误,不知道是不是 >> > 因为 IO::File 的问题 >> >> Digest::MD5 文档里提到 >> >> $md5->addfile($io_handle) >> In most cases you want to make sure that the $io_handle is in binmode >> before you pass it as argument to the addfile() method. >> >> binmode 试试。 >> >> Qiang >> >> -- >> >> > > > -- > Perl乐事 -- http://www.perlersh.org > 我的博客 -- http://www.perlersh.org/blog.html > 揭谛揭谛,波罗揭谛,波罗僧揭谛,菩提萨婆诃。 > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 > [email protected]<perlchina%[email protected]> > 。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > -- Yours Sincerely Zeng Hong -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
