NAME
File::At - Thin FFI wrapper around the POSIX *at() filesystem syscalls
SYNOPSIS
use File::At qw(
AT_FDCWD AT_REMOVEDIR
dir open_fd_at open_fh_at
unlinkat mkdirat
);
use Fcntl qw(O_RDONLY O_CREAT O_WRONLY);
my $root = dir("/some/base");
# Get an fd
my $fd = open_fd_at($root, "foo.txt", O_CREAT|O_WRONLY, 0644);
# Or a normal Perl filehandle
my $fh = open_fh_at($root, "bar.txt", O_CREAT|O_WRONLY, 0644);
print $fh "hello\n";
# Unlink relative to that directory
unlinkat($root->fd, "old.txt", 0) == 0
or die "unlinkat: $!";
DESCRIPTION
File::At exposes the modern POSIX/Linux *at() family of filesystem syscalls via FFI::Platypus, and gives you a small amount of sugar for working relative to a directory fd.
The bindings are intentionally thin; you can build richer, Perlish interfaces on top without having to remember the C prototypes or syscall names.
EXPORTS
Nothing by default. On request:
constants: AT_*, RENAME_*
helpers: dir, open_fd_at, open_fh_at
raw api: all the *at() functions listed above