… | |
… | |
23 | use base 'Exporter'; |
23 | use base 'Exporter'; |
24 | |
24 | |
25 | BEGIN { |
25 | BEGIN { |
26 | $VERSION = 0.011; |
26 | $VERSION = 0.011; |
27 | |
27 | |
28 | @EXPORT = qw(aio_read aio_write aio_open aio_close); |
28 | @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat); |
29 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); |
29 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); |
30 | |
30 | |
31 | require XSLoader; |
31 | require XSLoader; |
32 | XSLoader::load Linux::AIO, $VERSION; |
32 | XSLoader::load Linux::AIO, $VERSION; |
33 | } |
33 | } |
… | |
… | |
57 | |
57 | |
58 | =item Linux::AIO::nreqs |
58 | =item Linux::AIO::nreqs |
59 | |
59 | |
60 | Returns the number of requests currently outstanding. |
60 | Returns the number of requests currently outstanding. |
61 | |
61 | |
|
|
62 | =item aio_open($pathname, $flags, $mode, $callback) |
|
|
63 | |
|
|
64 | Asynchronously open or create a file and call the callback with the |
|
|
65 | filedescriptor. |
|
|
66 | |
|
|
67 | =item aio_close($fh, $callback) |
|
|
68 | |
|
|
69 | Asynchronously close a file and call the callback with the result code. |
|
|
70 | |
62 | =item aio_read($fh,$offset,$length, $data,$dataoffset,$callback) |
71 | =item aio_read($fh,$offset,$length, $data,$dataoffset,$callback) |
63 | |
72 | |
64 | =item aio_write($fh,$offset,$length, $data,$dataoffset,$callback) |
73 | =item aio_write($fh,$offset,$length, $data,$dataoffset,$callback) |
65 | |
74 | |
66 | Reads or writes C<length> bytes from the specified C<fh> and C<offset> |
75 | Reads or writes C<length> bytes from the specified C<fh> and C<offset> |
67 | into the scalar given by C<data> and offset C<dataoffset> and calls the |
76 | into the scalar given by C<data> and offset C<dataoffset> and calls the |
68 | callback without the actual number of bytes read (or undef on error). |
77 | callback without the actual number of bytes read (or undef on error). |
69 | |
78 | |
70 | =item aio_open($pathname, $flags, $mode, $callback) |
79 | =item aio_stat($fh_or_path,$callback) |
71 | |
80 | |
72 | Asynchronously open or create a file and call the callback with the |
81 | =item aio_lstat($fh,$callback) |
73 | filedescriptor. |
|
|
74 | |
82 | |
75 | =item aio_close($fh, $callback) |
83 | Works like perl's C<stat> or C<lstat> in void context, i.e. the callback |
|
|
84 | will be called after the stat and the results will be available using |
|
|
85 | C<stat _> or C<-s _> etc... |
76 | |
86 | |
77 | Asynchronously close a file and call the callback with the result code. |
87 | Currently, the stats are always 64-bit-stats, i.e. instead of returning an |
|
|
88 | error when stat'ing a large file, the results will be silently truncated |
|
|
89 | unless perl itself is compiled with large file support. |
78 | |
90 | |
79 | =cut |
91 | =cut |
80 | |
92 | |
81 | END { |
93 | END { |
82 | max_parallel 0; |
94 | max_parallel 0; |