AnyEvent-Filesys-Watcher

 view release on metacpan or  search on metacpan

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

	# Accept either an array of directories or an array reference of
	# directories.
	my @paths = ref $args[0] eq 'ARRAY' ? @{ $args[0] } : @args;

	my $fs_stats = {};

	my $rule = Path::Iterator::Rule->new;
	my $next = $rule->iter(@paths);
	while (my $file = $next->()) {
		my $path = $self->_makeAbsolute($file);
		my %stat = $self->_stat($path)
			or next; # Skip files that we cannot stat.
		$fs_stats->{$path} = \%stat;
	}

	return $fs_stats;
}

sub _makeAbsolute {
	my ($self, $path) = @_;

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

				$type = 'deleted';
			}
		} elsif (RESCAN eq $flag_type{$flag}) {
			die "must rescan\n";
		}
	}

	if ('deleted' eq $type) {
		delete $old_fs->{$path};
	} elsif ('modified' eq $type || 'created' eq $type) {
		$old_fs->{path} = $self->_stat($path);
	} else {
		# Issue a warning?
		return;
	}

	return AnyEvent::Filesys::Watcher::Event->new(
		path => $path,
		type => $type,
		is_directory => $is_directory,
		id => $raw_event->id,



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