-
-
14 May 2013 06:53:16 UTC
- Distribution: DataStore-CAS-FS
- Module version: 0.010000
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (342 / 39 / 0)
- Kwalitee
Bus factor: 1- 66.63% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (53.86KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Michael Conrad
- Dependencies
- Carp
- DataStore::CAS
- Fcntl
- File::Spec
- File::Spec::Functions
- JSON
- Moo
- Scalar::Util
- Socket
- Try::Tiny
- overload
- parent
- strict
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
DataStore::CAS::FS::Dir - Object representing a directory of file entries, indexed by filename.
VERSION
version 0.011000
SYNOPSIS
my $dir= DataStore::CAS::FS::Dir->new( file => $cas_file, format => $codec_name, entries => \@entries, metadata => $metadata );
DESCRIPTION
Directory objects have a very basic API of being able to fetch an entry by name (optionally case-insensitive, as the user chooses), and iterate all entries.
Directory objects are IMMUTABLE, as are the DirEnt objects they return.
ATTRIBUTES
file
Read-only, Required. The DataStore::CAS::File this directory was deserialized from.
store
Alias for file->store
hash
Alias for file->hash
size
Alias for file->size
format
The format string that identifies this directory encoding.
metadata
A hashref of arbitrary name/value pairs attached to the directory at the time it was written. DO NOT MODIFY. (In the future, this might be protected by Perl's internal const mechanism)
METHODS
new
$dir= $class->new( %params | \%params )
Create a new basic Dir object. The required parameters are
file
, andformat
.metadata
will default to an empty hashref, andentries
will default to an empty list.The
entries
parameter is not a public attribute, and is stored internally as_entries
. This is because not all subclasses will have an array of entries available. Use the methoditerator
instead.iterator
$i= $dir->iterator; while (my $next= $i->()) { ... }
Returns an iterator over the entries in the directory.
The iterator is a coderef where each successive call returns the next DirEnt. Returns undef at the end of the list. Entries are not guaranteed to be in any order, or even to be unique names. (in particular, because of case sensitivity rules)
get_entry
$dirEnt= $dir->get_entry($name, %flags)
Get a directory entry by name.
If
$flags{case_insensitive}
is true, then the directory will attempt to do a case-folding lookup on the given name. Note that all directories are case-sensitive when written, and the case-insensitive feature is meant to help emulate Windows-like behavior. In other words, you might have two entries that differ only by case, and the caseless lookup will pick one arbitrarily.AUTHOR
Michael Conrad <mconrad@intellitree.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Michael Conrad, and IntelliTree Solutions llc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install DataStore::CAS::FS, copy and paste the appropriate command in to your terminal.
cpanm DataStore::CAS::FS
perl -MCPAN -e shell install DataStore::CAS::FS
For more information on module installation, please visit the detailed CPAN module installation guide.