-
-
03 Dec 2005 22:52:45 UTC
- Distribution: File-System
- Module version: 1.16
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (459 / 50 / 0)
- Kwalitee
Bus factor: 1- 76.58% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (29.03KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Andrew Sterling Hanenkamp, E<lt>hanenkamp@users.sourceforge.netE<gt>
- Dependencies
- File::Copy::Recursive
- Parse::RecDescent
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
File::System::Layered - A file system implementation with "layered" roots
SYNOPSIS
use File::System; my $root = File::System->new('Layered', [ 'Real', root => '/usr/local' ], [ 'Real', root => '/usr' ], [ 'Real', root => '/cw/usr/local' ], [ 'Real', root => '/sw/usr/local' ], ); my $dir = $root->lookup('/bin'); print "All files:\n"; print map({ " - $_\n" } $root->children_paths);
DESCRIPTION
This file system allows for the layering of other file systems. A layerd file system contains one or more other file systems such that the list of files available at a certain path in the tree is the union of the files available in all the contained file systems. When reading from or writing to file content, the file system with the highest priority is given preference.
The priority of the file systems is determined during construction, and may be modified later.
LAYERED API
The constructor of this module provides the initial layer prioritization. The
File::System::Layered
package also provides methods for altering the layers after the file system has been established.- $root = File::System->new('Layered', @file_systems)
-
The constructor establishes the initial layout of the file system. Each element of
@file_systems
is either a file system object or is a reference to an array that may be passed toFile::System::new
to construct a file system object.The layers are prioritized by the order given in
@file_systems
. The file systems listed first are given the higher priority. - @layers = $obj->get_layers
-
Returns the list of the file system layers in descending order of priority. By using this method to get the list of layers, they can be reordered, removed, added to and then passed back to
set_layers
to alter the file system. - $obj->set_layers(@layers)
-
Reset the layers of the file system in descending order of priority. This effectively reinitializes the file system. The semantics are the same as that of the constructor.
BUGS
This list includes things that aren't always bugs, but eccentricities of the implementation forced by the the nature of the service provided. This provides an explanation for anything that might not be obvious. I've tried to make the implementations work in a simple and natural way, but a few decisions were arbitrary.
The
copy
,move
, andrename
methods are stuck within the file system they are in. That is, if you move, rename, or copy a file, the new file, location, or duplicate will be stored within the same layer as the original. If you attempt to move or copy to a location that exists in one layer, but not another, those methods will attempt to usecreate
to create the needed directory in the other layer. Due to these kinds of complications, these methods haven't yet been fully tested.Removing a file or directory might not have the expected effect. If there are two layers with the same file or directory, removal will just remove the version in the highest layer, so the file or directory will still appear to exist.
The
is_creatable
method returns true if any layer returns true. Thecreate
method uses theis_creatable
of each layer to find out if the file can be created and will create the file on the first layer it finds where it is true.The
glob
andfind
methods rely upon the slowish defaults. This situation could probably be improved with a little bit of effort.SEE ALSO
File::System, File::System::Object, File::System::Real, File::System::Table
AUTHOR
Andrew Sterling Hanenkamp, <hanenkamp@users.sourceforge.net>
COPYRIGHT AND LICENSE
Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.
This library is distributed and licensed under the same terms as Perl itself.
Module Install Instructions
To install File::System, copy and paste the appropriate command in to your terminal.
cpanm File::System
perl -MCPAN -e shell install File::System
For more information on module installation, please visit the detailed CPAN module installation guide.