Net-LibNFS

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

## $nfs\_fh = _OBJ_->open( $PATH, $FLAGS \[, $MODE\] )

Opens a file and returns a [Net::LibNFS::Filehandle](https://metacpan.org/pod/Net%3A%3ALibNFS%3A%3AFilehandle) instance to
interact with it.

## $obj = _OBJ_->mkdir( $PATH \[, $MODE\] )

Creates a directory.

Returns _OBJ_.

## $obj = _OBJ_->rmdir( $PATH )

Deletes a directory.

Returns _OBJ_.

## $obj = _OBJ_->chdir( $PATH )

Changes _OBJ_’s directory.

Returns _OBJ_.

## $obj = _OBJ_->mknod( $PATH, $MODE, $DEV )

Like [mknod(2)](http://man.he.net/man2/mknod).

Returns _OBJ_.

## $obj = _OBJ_->unlink( $PATH )

Deletes a file.

Returns _OBJ_.

## $nfs\_dh = _OBJ_->opendir( $PATH )

Opens a directory and returns a [Net::LibNFS::Dirhandle](https://metacpan.org/pod/Net%3A%3ALibNFS%3A%3ADirhandle) instance to
read from it.

## $statvfs\_obj = _OBJ_->statvfs( $PATH )

Like [statvfs(2)](http://man.he.net/man2/statvfs). Returns a [Net::LibNFS::StatVFS](https://metacpan.org/pod/Net%3A%3ALibNFS%3A%3AStatVFS) instance.

## $destination = _OBJ_->readlink( $PATH )

Reads a symlink directly.

## $obj = _OBJ_->chmod( $PATH, $MODE )

Sets a path’s mode.

Returns _OBJ_.

## $obj = _OBJ_->lchmod( $PATH, $MODE )

Like `chmod()` above but won’t follow symbolic links.

Returns _OBJ_.

## $obj = _OBJ_->chown( $PATH, $UID, $GID )

Sets a path’s ownership.

Returns _OBJ_.

## $obj = _OBJ_->utime( $PATH, $ATIME, $MTIME )

Updates $PATH’s atime & mtime. A time can be specified as either:

- A nonnegative number (not necessarily an integer).
- A reference to a 2-member array of nonnegative integers:
seconds and microseconds.

Returns _OBJ_.

## $obj = _OBJ_->lutime( $PATH, $ATIME, $MTIME )

Like `utime()` above but can operate on symlinks.

Returns _OBJ_.

## $obj = _OBJ_->lchown( $PATH, $MODE )

Like `chown()` above but won’t follow symbolic links.

Returns _OBJ_.

## $obj = _OBJ_->link( $OLDPATH, $NEWPATH )

Creates a hard link.

Returns _OBJ_.

## $obj = _OBJ_->symlink( $OLDPATH, $NEWPATH )

Creates a symbolic link.

Returns _OBJ_.

## $obj = _OBJ_->rename( $OLDPATH, $NEWPATH )

Renames a filesystem path.

Returns _OBJ_.

# UNIMPLEMENTED

The following libnfs features are unimplemented here:

- Authentication: Would be nice!
- URL parsing: Seems redundant with [URI](https://metacpan.org/pod/URI).
- `creat()` & `create()`: These are redundant with `open()`.
- `access()` & `access2()`: Merely knowing whether a given
file/directory is accessible isn’t as useful as it may seem because
by the time you actually _use_ the resource the permissions/ownership
could have changed. To prevent that race condition it’s better just to
`open()`/`opendir()` and handle errors accordingly.
- `lockf()`: Apparently redundant with `fcntl()`-based locks save
for the lock-test functionality, which is generally a misstep for the same
reason as `access()` above: by the time you use the resource—in this case,
request a lock on the file—the system state may have changed.

# SEE ALSO

[RFC 7530](https://datatracker.ietf.org/doc/html/rfc7530) is, as of this
writing, NFSv4’s official definition.

# LICENSE & COPYRIGHT

Copyright 2022 Gasper Software Consulting. All rights reserved.

Net::LibNFS is licensed under the same terms as Perl itself (cf.
[perlartistic](https://metacpan.org/pod/perlartistic)); **HOWEVER**, since Net::LibNFS links to libnfs, use of
Net::LibNFS _may_ imply acceptance of libnfs’s own copyright terms.
See `libnfs/COPYING` in this distribution for details.



( run in 1.062 second using v1.01-cache-2.11-cpan-71847e10f99 )