Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    File::Modified 0.07

    Download button

    No screenshots available
    Downloads: 294  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Max Maischein | More programs
    Perl Artistic License / FREE
    November 13th, 2007, 19:05 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    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=>['Import.cfg','Export.cfg']);

    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=>[values %INC, $0]);

    # 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 %ARGS

    Creates 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, method

    Adds 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 LIST

    Adds 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.

    update

    Updates all signatures to the current state. All pending changes are discarded.

    changed

    Returns a list of the filenames whose files did change since the construction or the last call to update (whichever last occurred).

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    check changes | verify modified files | Perl module | Perl | class | checker

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM