NAME

Filesys::POSIX - Provide POSIX-like filesystem semantics in pure Perl

SYNOPSIS

use Filesys::POSIX
use Filesys::POSIX::Mem;

my $fs = Filesys::POSIX->new(Filesys::POSIX::Mem->new,
    'noatime' => 1
);

$fs->umask(0700);
$fs->mkdir('foo');

my $fd = $fs->open('/foo/bar', $O_CREAT | $O_WRONLY);
my $inode = $fs->fstat($fd);
$fs->printf("I have mode 0%o\n", $inode->{'mode'});
$fs->close($fd);

DESCRIPTION

Filesys::POSIX provides a fairly complete suite of tools comprising the semantics of a POSIX filesystem, with path resolution, mount points, inodes, a VFS, and some common utilities found in the userland. Some features not found in a normal POSIX environment include the ability to perform cross- mountpoint hard links (aliasing), mapping portions of the real filesystem into an instance of a virtual filesystem, and allowing the developer to attach and replace inodes at arbitrary points with replacements of their own specification.

Two filesystem types are provided out-of-the-box: A filesystem that lives in memory completely, and a filesystem that provides a "portal" to any given portion of the real underlying filesystem.

By and large, the manner in which data is structured is quite similar to a real kernel filesystem implementation, with some differences: VFS inodes are not created for EVERY disk inode (only mount points); inodes are not referred to numerically, but rather by Perl reference; and, directory entries can be implemented in a device-specific manner, as long as they adhere to the normal interface specified within.

INSTANTIATING THE FILESYSTEM ENVIRONMENT

ERROR HANDLING

Errors are emitted in the form of exceptions thrown by Carp::confess(), with full stack traces. Where possible, $! is set with an appropriate error code from Errno, and a stringified $! is thrown.

SYSTEM CALLS

EXTENSION MODULES

UTILITIES

INTERFACES

INTERNALS

AUTHOR

Written by Xan Tronix xan@cpan.org

CONTRIBUTORS

COPYRIGHT

Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.