FileMetadata::Miner::Stat
use FileMetadata::Miner::Stat; my $config = {time => '%T', size => 'KB'}; my $miner = FileMetadata::Miner::Stat->new ($config); my $meta = {}; print "Size : $meta->{'FileMetadata::Miner::Stat::size'}" if $miner->mine ('path', $meta);
This module extracts three statistics for a file.
1. The creation time
2. The last modified time
3. Size
4. The type of the file
This module implements methods required for FileMetadata framework miners but can be used independently.
See "new" in FileMetadata::Miner
The config hash can contain two keys 'time' - Time format string acceptable to strftime. The default is '%T=%D'. Output is shown in "mine". For a list of possible values see the strftime.
'size' - One of 'KB', 'MB' or 'bytes'. The default is for the value to be in bytes and for no units to be specified in the value of the FileMetadata::Miner::Stat::size property. If this option is set, then the size is represented as 'VALUE UNITS'.
The following can be passed to the new function:
{ time => '%T', size => 'bytes' }
See "mine" in FileMetadata::Miner
This method uses the stat() function on the given file path. The following keys are set in the meta hash.
FileMetadata::Miner::Stat::ctime - Creation time of file
FileMetadata::Miner::Stat::mtime - Last modification time of file
FileMetadata::Miner::Stat::size - Size of file
FileMetadata::Miner::Stat::type - The type of the file. Either 'REG', 'DIR' or 'OTHER'. (Added in version 1.1)
time and size are formatted according to config options given to the new() method or by default as:
time '23:59:45-01/31/2002'
size '10 KB' '10240 bytes' '10240'
1.1 - This is a small update to the first release
POSIX
Midh Mulpuri midh@enjine.com
This software can be used under the terms of any Open Source Initiative approved license. A list of these licenses are available at the OSI site - http://www.opensource.org/licenses/
To install FileMetadata::Store, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FileMetadata::Store
CPAN shell
perl -MCPAN -e shell install FileMetadata::Store
For more information on module installation, please visit the detailed CPAN module installation guide.