第二种用法看来后面没法close了。

应该把IO::File的new的返回结果存到一个变量里,以后好close。

2009/12/22 joe jiang <[email protected]>

> 可以用大文件测试一下磁盘 IO。
>
>
> Chat Skype: joejiang799 MSN: [email protected]
> Contact Me [image: Linkedin]<http://cn.linkedin.com/pub/joe-jiang/12/552/940> 
> [image:
> Flickr] <http://www.flickr.com/photos/40820...@n04>
>
>
> --- @ WiseStamp Signature <http://www.wisestamp.com/email-install>. Get it
> now <http://www.wisestamp.com/email-install>
>
>
> 2009/12/22 Hong Mayi <[email protected]>
>
> 你的意思是两种方法使用的 IO 是相同的?
>>
>> 2009/12/21 Xiaojun Deng <[email protected]>
>>
>> On Mon, Dec 21, 2009 at 11:32:22AM +0800, Hong Mayi wrote:
>>>
>>> >现在的问题不是说不能计算md5,两种模式都可以计算,我想确认一下两种模式的区别,还有对硬盘IO的读取和写入利用的频繁程度,我在确认问题出现的地方,如果确实是
>>> >IO::File 对硬盘造成大量的读写导致的 read-only system
>>> 错误,我就要换个方式来处理这个问题了,比如用第一种方法或者其他方式
>>> >
>>>
>>> 读磁盘是kernel去做的, 不关user sapce什么事情的.
>>> 这两种方法在底层应该没什么区别
>>>
>>> >我现在不能确定换了第一种方法是否可以减少对文件系统的 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
>>> >>
>>> >> --
>>> >>
>>> >> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> >> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> >> 要取消订阅此网上论坛,请发送电子邮件至 
>>> >> [email protected]<perlchina%[email protected]>
>>> <perlchina%[email protected]<perlchina%[email protected]>
>>> >
>>> >> 。
>>> >> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>> >>
>>> >>
>>> >>
>>> >
>>> >--
>>> >
>>> >您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> >要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> >要取消订阅此网上论坛,请发送电子邮件至 
>>> >[email protected]<perlchina%[email protected]>
>>> 。
>>> >若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>> >
>>> >
>>>
>>> --
>>> 买彩票中了五百万大奖, 兑奖的时候, 突然醒了...
>>>
>>> --
>>>
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>> [email protected]<perlchina%[email protected]>
>>> 。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>
>>>
>>>
>>  --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>



-- 
---------------------------
Achilles Xu
http://www.lostcode.org

--

您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。


回复