The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FileMetadata::Miner::Stat

SYNOPSIS

  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);

DESCRIPTION

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.

METHODS

new

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'

  }

mine

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'

VERSION

1.1 - This is a small update to the first release

REQUIRES

POSIX

AUTHOR

Midh Mulpuri midh@enjine.com

LICENSE

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/