Net::LibNFS::Async - Non-blocking I/O for Net::LibNFS
After creating $nfs_async from a Net::LibNFS instance …
$nfs_async
$nfs->mount("the.nfs.server", "/export-dir")->then( sub { return $nfs->stat("/"); }, )->then( sub ($stat) { printf "mode(/) = 0%03o\n", $stat->mode() & 0777; return $nfs->open('/some-file', Fcntl::O_RDONLY); }, )->then( sub ($fh) { return $fh->read(120)->then( sub ($buf) { print $buf; return $fh->close(); }, ); }, )->then( sub { return $nfs->umount(); } )
This module exposes non-blocking counterparts to Net::LibNFS’s blocking I/O calls.
Its methods return promises. (Mozilla publishes a nice introduction to promises that may be of help if you’re unfamiliar with that pattern.)
The below all accept the same arguments as their equivalents in Net::LibNFS.
Promise resolves empty.
Promise resolves to a Net::LibNFS::Stat instance.
Promise resolves to a Net::LibNFS::Async::Filehandle instance.
Promise resolves to a Net::LibNFS::Dirhandle instance.
Promise resolves to a Net::LibNFS::StatVFS instance.
Promise resolves to an arrayref of hashrefs such as Net::LibNFS’s corresponding static function returns.
Pauses all reads. (Writes still continue.)
Returns OBJ.
The inverse of pause().
pause()
To install Net::LibNFS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::LibNFS
CPAN shell
perl -MCPAN -e shell install Net::LibNFS
For more information on module installation, please visit the detailed CPAN module installation guide.