File::Modified

File::Modified class checks intelligently if files have changed.
Download

File::Modified Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Max Maischein
  • Publisher web site:
  • http://search.cpan.org/~corion/HTML-Display-0.39/lib/HTML/Display.pm

File::Modified Tags


File::Modified Description

File::Modified class checks intelligently if files have changed. File::Modified class checks intelligently if files have changed.SYNOPSIS use strict; use File::Modified; my $d = File::Modified->new(files=>); while (1) { my (@changes) = $d->changed; if (@changes) { print "$_ was changedn" for @changes; $d->update(); }; sleep 60; };Second example - a script that knows when any of its modules have changed : use File::Modified; my $files = File::Modified->new(files=>); # We want to restart when any module was changed exec $0, @ARGV if $files->changed();The Modified module is intended as a simple method for programs to detect whether configuration files (or modules they rely on) have changed. There are currently two methods of change detection implemented, mtime and MD5. The MD5 method will fall back to use timestamps if the Digest::MD5 module cannot be loaded.There is another module, File::Signature, which has many similar features, so if this module doesn't do what you need, maybe File::Signature does. There also is quite some overlap between the two modules, code wise.new %ARGSCreates a new instance. The %ARGS hash has two possible keys, Method, which denotes the method used for checking as default, and Files, which takes an array reference to the filenames to watch.add filename, methodAdds a new file to watch. method is the method (or rather, the subclass of File::Modified::Signature) to use to determine whether a file has changed or not. The result is either the File::Modified::Signature subclass or undef if an error occurred.addfile LISTAdds a list of files to watch. The method used for watching is the default method as set in the constructor. The result is a list of File::Modified::Signature subclasses.updateUpdates all signatures to the current state. All pending changes are discarded.changedReturns a list of the filenames whose files did change since the construction or the last call to update (whichever last occurred). Requirements: · Perl


File::Modified Related Software