File::Signature

File::Signature is a Perl module to detect changes to a file's content or attributes.
Download

File::Signature Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jeremy Madea
  • Publisher web site:
  • http://search.cpan.org/~jeremy/File-Signature-1.009/Signature.pm

File::Signature Tags


File::Signature Description

File::Signature is a Perl module to detect changes to a file's content or attributes. File::Signature is a Perl module to detect changes to a file's content or attributes.SYNOPSIS use File::Signature; my $sig = File::Signature->new('/some/file'); # If you have a stringified signature stored in $string # you can create a File::Signature object from it. my $sig = File::Signature->new_from_string($string); if (my $err = $sig->error) { warn $err, "n"; } # You can use a signature object to re-check the same file. if ( $sig->is_same() ) { print "Ok. The signature is the same.n" } if ( $sig->changed() ) { print "Uh Oh! The signature has changed.n" } my @digests = $sig->old_and_new('digest'); my @inodes = $sig->old_and_new('ino'); my @modes = $sig->old_and_new('mode'); my @uid = $sig->old_and_new('uid'); my @gid = $sig->old_and_new('gid'); my @mtime = $sig->old_and_new('mtime'); # A slightly more worthwhile use... my @fields = $sig->changed(); for my $field (@fields) { printf "$field was: %s but changed to %s.n", $sig->old_and_new($field); }ABSTRACTThis perl library uses perl5 objects to assist in determining whether a file's contents or attributes have changed. It maintains several pieces of information about the file: a digest (currently only MD5 is supported), its inode number, its mode, the uid of its owner, the gid of its group owner, and its last modification time. A File::Signature object is closely associated with a single pathname. It provides a way to compare the state of a file over different points in time; it isn't useful for comparing different files.This module provides a way to monitor files for changes. It implements an object oriented interface to file "signatures." In the case of this module, a signature includes an MD5 digest (other digests may be added later), the file's size, its inode number, its mode, its owner's uid, its group's gid, and its mtime. This information is associated with a file by the file's "pathname." The pathname is considered to be the file's unique identifier. In reality, a file may have more than one pathname, but this module doesn't recognize that.It will simply treat two differing pathnames as two different files, even if they refer to the same file. As this module checks whether a file changes over time, a minimal use of it would include the time when the signature was created and a different time when the signature is regenerated and compared with the previous one. The amount of time between these checks is arbitrary. This module makes it easy to save a signature object and then load it and check for consistency at a later time, whether seconds or years have passed.Requirements:· PerlWhat's New in This Release:· Fixups to tests.


File::Signature Related Software