NAME
File::System - Central factory for File::System modules
SYNOPSIS
my $root = File::System->new("Real", root => '/var/chroot/foo');
my $file = $root->lookup('/etc/fstab');
print $file->lines;
DESCRIPTION
Nota Bene: This package is still in development, so some aspects of the API are likely to change.
The File::System library is intended to provide an interface to a file system. Generally, a file system is a heirarchical arrangement of records commonly found on most modern computers. This library attempts to generalize this idea as it pertains to loading and accessing these files. This is not meant to generalize on the specifics of file system implementations or get into hardware details.
The goal of this system is not to present the file system in a native way, but to provide the Perl program using it a simple hook into a potentially complex structure. Thus, certain file system module requirements may force unnatural or arbitrary constraints on the file system appearance. The most notable is that this implementation purposely does not address the concept of "volumes" except to state that such things should just be made parts of the file system under an artificial root.
This system is also still immature and certain aspects---notably the concept of "capabilities" and "permissions"---are absent. These may be added in future making existing file modules created to this system incompatible with future revisions. I will try to make sure that such things are "optional" such that the system can function in a crippled way without support for these future additions when they come, but I make guarantees.
FACTORY SYSTEM
The File::System
module provides a central interface into loading other File::System
modules. It provides a single method for instantiating a file system module:
- $root = File::System->new($module_name, ...)
-
This will create and return the root file system object (i.e., an instance of File::System::Object) for the file system module named
$module_name
.If the
$module_name
does not contain any colons, then it the package "File::System::$module_name
" is loaded and thenew
method for that package is used to create the object. Otherwise, the$module_name
is loaded and it'snew
method is used. For example,$fs = File::System->new('Real') # Module File::System::Real is loaded # Method File::System::Real->new is called $fs = File::System->new('My::File::System::Foo') # Module My::File::System::Foo is loaded # Method My::File::System::Foo->new is called
Any additional arguments passed to this method are then passed to the
new
method of the loaded package.
The returned object will behave according to the documentation available in File::System::Object.
TODO
I would like to create a set of regular regression tests that can be applied to any module to prove its working order.
SEE ALSO
File::Find, File::System::Object
AUTHOR
Andrew Sterling Hanenkamp, <hanenkamp@users.sourceforge.net>
COPYRIGHT AND LICENSE
Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.
This software is distributed and licensed under the same terms as Perl itself.