--- IO-AIO/AIO.pm 2005/09/07 17:41:17 1.41 +++ IO-AIO/AIO.pm 2005/12/29 15:44:13 1.47 @@ -17,6 +17,10 @@ $_[0] > 0 or die "read error: $!"; }; + # AnyEvent + open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!"; + my $w = AnyEvent->io (fh => $fh, poll => 'r', cb => sub { IO::AIO::poll_cb }); + # Event Event->io (fd => IO::AIO::poll_fileno, poll => 'r', @@ -65,7 +69,7 @@ use Fcntl (); BEGIN { - $VERSION = '1.61'; + $VERSION = '1.72'; @EXPORT = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink @@ -235,7 +239,7 @@ Asynchronously rmdir (delete) a directory and call the callback with the result code. -=item aio_readdir $pathname $callback->($entries) +=item aio_readdir $pathname, $callback->($entries) Unlike the POSIX call of the same name, C reads an entire directory (i.e. opendir + readdir + closedir). The entries will not be @@ -296,7 +300,7 @@ # stat once aio_stat $path, sub { - $cb->() if $_[0]; + return $cb->() if $_[0]; my $hash1 = join ":", (stat _)[0,1,3,7,9]; # read the directory entries @@ -317,7 +321,7 @@ # if nlink == 2, we are finished # on non-posix-fs's, we rely on nlink < 2 $ndirs = (stat _)[3] - 2 - or $cb->([], $entries); + or return $cb->([], $entries); } # sort into likely dirs and likely nondirs @@ -343,7 +347,7 @@ # finished undef $statcb; undef $schedcb; - $cb->(\@dirs, \@nondirs); + $cb->(\@dirs, \@nondirs) if $cb; undef $cb; } };