NAME

File::Properties::Regular - Perl module representing properties of a regular file

SYNOPSIS

use File::Properties::Cache;
use File::Properties::Regular;

my $fpc = File::Properties::Regular->cache('cache.db');

my $fpr = File::Properties::Regular->new('/path/to/file', $fpc);
print "File digest: " . $fpr->digest . "\n";

ABSTRACT

File::Properties::Regular is a Perl module representing properties
of a regular file; specifically, the mime type and SHA-2 digest of
the file content, in addition to the properties stored in
File::Properties::Generic from which it is derived.

DESCRIPTION

File::Properties::Regular is a Perl module representing properties
of a regular file; specifically, the mime type and SHA-2 digest of
the file content, in addition to the properties stored in
File::Properties::Generic from which it is derived. If a reference to
a File::Properties::Cache object is specified in the constructor,
access to the properties is via the cache.
new
my $fpr = File::Properties::Regular->new($path, $fpc);

Constructs a new File::Properties::Regular object.

mimetype
print "File mime type: " . $fpr->mimetype . "\n";

Determine the mime type of the represented file.

digest
print "File digest: " . $fpr->digest . "\n";

Determine the file digest for the represented file.

string
print $fpr->string . "\n";

Construct a string representing the object data.

cachekey
my $cka = $fpr->cachekey($path_is_cached_flag);

Construct an array representing the key for the cache table for this class.

cache
my $fpc = $fpr->cache('cache.db', $options_hash);

Construct a File::Properties::Cache object attached to the specified database file. If $options_hash includes the key 'CachedPath', its value determines whether the file path is cached. Note that path caching is enabled by default, and will also be enabled, ignoring the 'CachedPath' option, if $File::Properties::Generic::FullStatSupport is false (indicating that file device and inode numbers can not be determined). All other $options_hash entries are passed on to the constructor for the File::Properties::Cache class.

_cacheinit
$fpr->_cacheinit($fpc, $options_hash);

Initialise the regular file properties cache table in the cache referred to by the File::Properties::Cache reference argument.

SEE ALSO

File::Properties, File::Properties::Cache, File::Properties::Generic

AUTHOR

Brendt Wohlberg <wohl@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010,2011 by Brendt Wohlberg

This library is available under the terms of the GNU General Public License (GPL), described in the LICENSE file included in this distribution.