DataStore::CAS::FS::Dir - Object representing a directory of file entries, indexed by filename.
version 0.011000
my $dir= DataStore::CAS::FS::Dir->new( file => $cas_file, format => $codec_name, entries => \@entries, metadata => $metadata );
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.
Read-only, Required. The DataStore::CAS::File this directory was deserialized from.
Alias for file->store
Alias for file->hash
Alias for file->size
The format string that identifies this directory encoding.
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)
$dir= $class->new( %params | \%params )
Create a new basic Dir object. The required parameters are file, and format. metadata will default to an empty hashref, and entries will default to an empty list.
file
format
metadata
entries
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 method iterator instead.
_entries
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)
$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.
$flags{case_insensitive}
Michael Conrad <mconrad@intellitree.com>
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.
To install DataStore::CAS::FS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DataStore::CAS::FS
CPAN shell
perl -MCPAN -e shell install DataStore::CAS::FS
For more information on module installation, please visit the detailed CPAN module installation guide.