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

NAME

Date::LastModified - Return last-modified date from a set of resources

SYNOPSIS

  use Date::LastModified;
  my $dlm = new Date::LastModified("CFGFILE");
  my $dlm = new Date::LastModified(
   { "dlm_file" => [ "/www/data/index.html", "/www/data/iso9001/index.html" ] } );

  $time   = $dlm->last;     # return last-modified time() format
  $string = $dlm->from;     # return last-modified resource info

DESCRIPTION

Date::LastModified extracts the last modification date from one or more resources, which can be files ("dlm_file"), directories ("dlm_dir"), or DBI-compatible databases ("dlm_dbi"). It should be possible to subclass Date::LastModified to add other resource types, like web pages or external sensors.

Date::LastModified uses AppConfig to parse the configuration file. To pass resources directly, specify them with a hashref to new() where the value is an array ref:

dlm_file

Looks at the file's last-modified date.

dlm_dir

Looks at all the files in that directory and its subdirectories, using the latest file.

dlm_dbi

Looks at the database table and uses the last date for the specified field.

The time()-compatible time of the latest resource is returned by last().

Once last() has been called, you can obtain which resource was the last-modified by calling from(). If last() has not been called, from() returns undef.

CONFIGURATION FILES

Date::LastModified uses AppConfig to parse the configuration file, so you can specify the resources in one of two ways, either directly:

    dlm_file = /etc/passwd
    dlm_dir  = /www/data

or in a section:

    [dlm]
    file = /etc/passwd
    dir  = /www/data

Both styles result in the same outcome. The section style is useful if Date::LastModified will be used in a larger program that requires other configuration file info.

EXTRACTING A TIME()

The $unix_time hashref supports a phrasebook pattern for extracting a time() from the database for comparisons. This hashref is where you can add database drivers, although these drivers are already supported:

    Oracle (V7 & V8)
    MySQL  (V3)
    SQLite (V2)

There is also a pseudo-entry "SQL92" that should have the correct syntax for SQL92-compatible databases like Oracle9i.

EXPORT

None by default.

TESTING

DBI tests assume that the database(s) are updated regularly but not every minute or every second.

AUTHOR

Mark Leighton Fisher, <mark-fisher@mindspring.com<gt>

SEE ALSO

perl.