Q about Coro file::find

Aleksandar Lazic al-anyevent at none.at
Thu Feb 2 15:50:00 CET 2012


Hi Marc,

On 01-02-2012 23:12, Marc Lehmann wrote:
> On Wed, Feb 01, 2012 at 11:27:09AM +0100, Aleksandar Lazic
> <al-anyevent at none.at> wrote:
>> Can I change the following line
>>
>>  aio_lstat [$wd, $_] for @$files;
>>
>> to
>>
>>  aio_lstat $wd, sub {$outhash->{'bytes'} += -s _} for @$files;
>>
>> to calculate the bytes in the directory as
>
> Almost, the sub{} should be fine, but you also replaced "[$wd, $_]" 
> (== file
> _$ relative to dir $wd), by $wd only. This might work better:
>
>   aio_lstat [$wd, $_], sub {$outhash->{'bytes'} += -s _} for @$files;

After read more carfully the doc I came to the same solution.

Many thanks for your help.

Btw.: I'am watching now your Presentation about
       AnyEvent, Coro, IO::AIO - a good team on
       YAPC::Asia Tokyo 2011

Very interesting.

BR
Aleks



More information about the anyevent mailing list