AnyEvent-Filesys-Watcher

 view release on metacpan or  search on metacpan

lib/AnyEvent/Filesys/Watcher/FSEvents.pm  view on Meta::CPAN

	# a duplicate of that file.  Since this only accompanies a
	# kFSEventStreamEventFlagItemCreated, we can safely ignore it.
	kFSEventStreamEventFlagItemCloned => IGNORE,
);

sub new {
	my ($class, %args) = @_;

	$args{interval} = 0.1 if !exists $args{interval};

	my $self = $class->SUPER::_new(%args);

	delete $args{directories};
	delete $args{callback};
	delete $args{filter};
	my $fs_monitor = Mac::FSEvents->new({
		path => $self->directories,
		latency => $args{interval},
		file_events => $has_file_events,
		%args,
	});

lib/AnyEvent/Filesys/Watcher/Fallback.pm  view on Meta::CPAN

use Locale::TextDomain ('AnyEvent-Filesys-Watcher');

use AnyEvent;
use Scalar::Util qw(weaken);

use base qw(AnyEvent::Filesys::Watcher);

sub new {
	my ($class, %args) = @_;

	my $self = $class->SUPER::_new(%args);

	my $alter_ego = $self;
	my $impl = AnyEvent->timer(
		after => $self->interval,
		interval => $self->interval,
		cb => sub {
			$alter_ego->_processEvents();
		}
	);
	weaken $alter_ego;

lib/AnyEvent/Filesys/Watcher/Inotify2.pm  view on Meta::CPAN

use Linux::Inotify2;
use Carp;
use Path::Iterator::Rule;
use Scalar::Util qw(weaken);

use base qw(AnyEvent::Filesys::Watcher);

sub new {
	my ($class, %args) = @_;

	my $self = $class->SUPER::_new(%args);

	my $inotify = Linux::Inotify2->new
		or croak "Unable to create new Linux::INotify2 object: $!";

	# Need to add all the subdirs to the watch list, this will catch
	# modifications to files too.
	my $old_fs = $self->_oldFilesystem;
	my @dirs = grep { $old_fs->{$_}->{is_directory} } keys %$old_fs;

	my $alter_ego = $self;

lib/AnyEvent/Filesys/Watcher/KQueue.pm  view on Meta::CPAN

			my ($limit) = BSD::Resource::getrlimit($resource);
			$WARN_FILEHANDLE_LIMIT = $limit >> 1;
			last;
		}
	}
};

sub new {
	my ($class, %args) = @_;

	my $self = $class->SUPER::_new(%args);

	my $kqueue = IO::KQueue->new;
	if (!$kqueue) {
		require Carp;
		Carp::croak(
			__x("Unable to create new IO::KQueue object: {error}",
			    error => $!)
		);
	}
	$self->_filesystemMonitor($kqueue);

lib/AnyEvent/Filesys/Watcher/ReadDirectoryChanges.pm  view on Meta::CPAN

use File::Spec;
use Cwd;
use AnyEvent::Filesys::Watcher::Event;
use AnyEvent::Filesys::Watcher::ReadDirectoryChanges::Queue;

use base qw(AnyEvent::Filesys::Watcher);

sub new {
	my ($class, %args) = @_;

	my $self = $class->SUPER::_new(%args);

	my $queue = AnyEvent::Filesys::Watcher::ReadDirectoryChanges::Queue->new;
	my $watcher = Filesys::Notify::Win32::ReadDirectoryChanges->new(
		queue => $queue,
	);
	foreach my $directory (@{$self->directories}) {
		eval {
			$watcher->watch_directory(path => $directory, subtree => 1);
		};
		if ($@) {



( run in 1.349 second using v1.01-cache-2.11-cpan-49f99fa48dc )