
[![Windows](https://github.com/Corion/Mojo-File-ChangeNotify/workflows/windows/badge.svg)](https://github.com/Corion/Mojo-File-ChangeNotify/actions?query=workflow%3Awindows)
[![MacOS](https://github.com/Corion/Mojo-File-ChangeNotify/workflows/macos/badge.svg)](https://github.com/Corion/Mojo-File-ChangeNotify/actions?query=workflow%3Amacos)
[![Linux](https://github.com/Corion/Mojo-File-ChangeNotify/workflows/linux/badge.svg)](https://github.com/Corion/Mojo-File-ChangeNotify/actions?query=workflow%3Alinux)

# NAME

Mojo::File::ChangeNotify - turn file changes into Mojo events

# SYNOPSIS

    my $watcher =
      Mojo::File::ChangeNotify->instantiate_watcher
          ( directories => [ '/my/path', '/my/other' ],
            filter      => qr/\.(?:pm|conf|yml)$/,
            on_change   => sub( $watcher, @event_lists ) {
                ...
            },
          );

    # alternatively
    $watcher->on( 'change' => sub( $watcher, @event_lists ) {
        for my $l (@event_lists) {
            for my $e ($l->@*) {
                print "[$e->{type}] $e->{path}\n";
            }
        }
    });
    # note that the watcher might need about 1s to start up

# IMPLEMENTATION

[File::ChangeNotify](https://metacpan.org/pod/File%3A%3AChangeNotify) only supports blocking waits or polling as an
interface. This module creates a subprocess that blocks and communicates
the changes to the main process.

# SEE ALSO

[File::ChangeNotify](https://metacpan.org/pod/File%3A%3AChangeNotify) - the file watching implementation
