… | |
… | |
167 | use common::sense; |
167 | use common::sense; |
168 | |
168 | |
169 | use base 'Exporter'; |
169 | use base 'Exporter'; |
170 | |
170 | |
171 | BEGIN { |
171 | BEGIN { |
172 | our $VERSION = '4.19'; |
172 | our $VERSION = 4.31; |
173 | |
173 | |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
… | |
… | |
1555 | passing C<undef> as working directory component of a pathname fails the |
1555 | passing C<undef> as working directory component of a pathname fails the |
1556 | request with C<ENOENT>, there is often no need for error checking in the |
1556 | request with C<ENOENT>, there is often no need for error checking in the |
1557 | C<aio_wd> callback, as future requests using the value will fail in the |
1557 | C<aio_wd> callback, as future requests using the value will fail in the |
1558 | expected way. |
1558 | expected way. |
1559 | |
1559 | |
1560 | If this call isn't available because your OS lacks it or it couldn't be |
|
|
1561 | detected, it will be emulated by calling C<fsync> instead. |
|
|
1562 | |
|
|
1563 | =item IO::AIO::CWD |
1560 | =item IO::AIO::CWD |
1564 | |
1561 | |
1565 | This is a compiletime constant (object) that represents the process |
1562 | This is a compiletime constant (object) that represents the process |
1566 | current working directory. |
1563 | current working directory. |
1567 | |
1564 | |
… | |
… | |
1934 | |
1931 | |
1935 | This is a very bad function to use in interactive programs because it |
1932 | This is a very bad function to use in interactive programs because it |
1936 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1933 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1937 | use an C<aio_group> together with a feed callback. |
1934 | use an C<aio_group> together with a feed callback. |
1938 | |
1935 | |
1939 | It's main use is in scripts without an event loop - when you want to stat |
1936 | Its main use is in scripts without an event loop - when you want to stat |
1940 | a lot of files, you can write somehting like this: |
1937 | a lot of files, you can write somehting like this: |
1941 | |
1938 | |
1942 | IO::AIO::max_outstanding 32; |
1939 | IO::AIO::max_outstanding 32; |
1943 | |
1940 | |
1944 | for my $path (...) { |
1941 | for my $path (...) { |
… | |
… | |
1984 | |
1981 | |
1985 | =back |
1982 | =back |
1986 | |
1983 | |
1987 | =head3 MISCELLANEOUS FUNCTIONS |
1984 | =head3 MISCELLANEOUS FUNCTIONS |
1988 | |
1985 | |
1989 | IO::AIO implements some functions that might be useful, but are not |
1986 | IO::AIO implements some functions that are useful when you want to use |
1990 | asynchronous. |
1987 | some "Advanced I/O" function not available to in Perl, without going the |
|
|
1988 | "Asynchronous I/O" route. Many of these have an asynchronous C<aio_*> |
|
|
1989 | counterpart. |
1991 | |
1990 | |
1992 | =over 4 |
1991 | =over 4 |
1993 | |
1992 | |
1994 | =item IO::AIO::sendfile $ofh, $ifh, $offset, $count |
1993 | =item IO::AIO::sendfile $ofh, $ifh, $offset, $count |
1995 | |
1994 | |
… | |
… | |
2113 | |
2112 | |
2114 | See the C<splice(2)> manpage for details. |
2113 | See the C<splice(2)> manpage for details. |
2115 | |
2114 | |
2116 | =item IO::AIO::tee $r_fh, $w_fh, $length, $flags |
2115 | =item IO::AIO::tee $r_fh, $w_fh, $length, $flags |
2117 | |
2116 | |
2118 | Calls the GNU/Linux C<tee(2)> syscall, see it's manpage and the |
2117 | Calls the GNU/Linux C<tee(2)> syscall, see its manpage and the |
2119 | description for C<IO::AIO::splice> above for details. |
2118 | description for C<IO::AIO::splice> above for details. |
2120 | |
2119 | |
2121 | =item $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
2120 | =item $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
2122 | |
2121 | |
2123 | Attempts to query or change the pipe buffer size. Obviously works only |
2122 | Attempts to query or change the pipe buffer size. Obviously works only |