NAME

AnyEvent::Filesys::Watcher::Event - Filesystem Change Events

SYNOPSIS

die "AnyEvent::Filesys::Watcher::Event should not be used"
    . " directly. Use AnyEvent::Filesys::Watcher instead";

DESCRIPTION

This class provides an abstraction for filesystem change events for AnyEvent::Filesys::Watcher.

CONSTRUCTORS

The following constructors are available:

new(ARGUMENTS)

Creates an event instance. The following named arguments are supported:

path PATH

PATH must be the absolute path to the file that changed. Required.

type TYPE

TYPE must be one of "created", "modified", "deleted". Required.

is_directory BOOLEAN

BOOLEAN must be a a truthy value for directories, false otherwise.

id ID

ID must be a unique identifier. Optional.

timestamp TIMESTAMP

Should be a reference to a two-element array with the seconds and the microseconds since the epoch. If missing, it defaults to what Time::HiRes::gettimeofday() returns.

METHODS

path

Returns the path.

type

Returns the type as a string.

isDirectory

Returns a truthy value for directories, false otherwise.

isCreated

Returns a truty value if the event was triggered by a file creation.

isDeleted

Returns a truty value if the event was triggered by a file deletion.

isModified

Returns a truty value if the event was triggered by a file modification.

id

Returns the unique id if specified.

timestamp

Returns the timestamp of the event.

cmp

Compare the timestamps of two events and returns -1, 0, or 1 like the operator cmp does. This can be used, when sorting two events.

SEE ALSO

AnyEvent::Filesys::Watcher, perl(1)