The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

POE::Component::DirWatch::Object::NewFile

SYNOPSIS

  use POE::Component::DirWatch::Object::NewFile;

  #$watcher is a PoCo::DW:Object::NewFile 
  my $watcher = POE::Component::DirWatch::Object::NewFile->new
    (
     alias      => 'dirwatch',
     directory  => '/some_dir',
     filter     => sub { $_[0] =~ /\.gz$/ && -f $_[1] },
     callback   => \&some_sub,
     interval   => 1,
     edited     => 1,   #pick up files that have been edited since last poll
    );

  $poe_kernel->run;

DESCRIPTION

POE::Component::DirWatch::Object::NewFile extends DirWatch::Object in order to exclude files that have already been processed

Accessors

seen_files

Read-write. Will return a hash ref in with keys will be the full path of all previously processed documents that still exist in the file system and the values are the last changed dates of the files.

edited

Read-Write. A boolean value, if set to true it will re-process edited files. If changed during runtime to true it will only pick up files that whose last edited date changed after edited was set to true.

Extended methods

dispatch

before 'dispatch' the dipatch list is compared against $self->seen_files and previously seen files are dropped from that list. at the end it adds all new files to the list of known files.

poll

before 'poll' the list of known files is checked and if any of the files no longer exist they are removed from the list of known files to avoid the list growing out of control. This makes a kind-of bug, look below.

meta

Keeping tests happy.

SEE ALSO

POE::Component::DirWatch::Object, Moose

AUTHOR

Guillermo Roditi, <groditi@cpan.org>

BUGS

If a file is created and deleted between polls it will never be seen. Also if a file is edited more than once in between polls it will never be picked up.

Please report any bugs or feature requests to bug-poe-component-dirwatch-object at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-DirWatch-Object. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc POE::Component::DirWatch::Object::NewFile

You can also look for information at:

ACKNOWLEDGEMENTS

People who answered way too many questions from an inquisitive idiot:

#PoE & #Moose
Matt S Trout <mst@shadowcatsystems.co.uk>
Rocco Caputo

COPYRIGHT

Copyright 2006 Guillermo Roditi. All Rights Reserved. This is free software; you may redistribute it and/or modify it under the same terms as Perl itself.