POE::Component::DirWatch::Modified - POE::Component::DirWatch::Modified documentation


POE-Component-DirWatch documentation Contained in the POE-Component-DirWatch distribution.

Index


Code Index:

NAME

Top

POE::Component::DirWatch::Modified

DESCRIPTION

Top

POE::Component::DirWatch::Modified extends DirWatch::New in order to exclude files that have already been seen, but still pick up files that have been changed. Usage is identical to POE::Component::DirWatch.

This module consumes the POE::Component::DirWatch::Role::Signatures role, please see its documentation for information about methods or attributes it provides or extends.

METHODS

Top

_file_callback

override '_file_callback' Don't call the callback if file has been seen before and is unchanged.

meta

See Moose

SEE ALSO

Top

POE::Component::DirWatch::New, POE::Component::DirWatch

COPYRIGHT

Top


POE-Component-DirWatch documentation Contained in the POE-Component-DirWatch distribution.

package POE::Component::DirWatch::Modified;

use POE;
use Moose;

our $VERSION = "0.300000";

extends 'POE::Component::DirWatch';
with 'POE::Component::DirWatch::Role::Signatures';

#--------#---------#---------#---------#---------#---------#---------#---------

around '_file_callback' => sub {
  my $orig = shift;
  my ($self, $file) = @_[OBJECT, ARG0];
  my $sigs = $self->signatures;
  my $new_sig = $self->_generate_signature($file);
  return if exists $sigs->{"$file"} && $sigs->{"$file"} eq $new_sig;
  $sigs->{"$file"} = $new_sig;
  return $orig->(@_);
};

__PACKAGE__->meta->make_immutable;

1;

__END__;

#--------#---------#---------#---------#---------#---------#---------#---------