---
name: "Catalyst::Engine::HTTP::Restarter::Watcher"
section: "3pm"
platform: "linux"
package: "libcatalyst-perl"
version: "5.7014-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Catalyst::Engine::HTTP::Restarter::Watcher"
---

# Catalyst::Engine::HTTP::Restarter::Watcher(3pm)

Catalyst::Engine::HTTP::Restarter::Watcher - Watch for changed application files

```
    my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new(
        directory => '/path/to/MyApp',
        regex     => '\.yml$|\.yaml$|\.conf|\.pm$',
        delay     => 1,
    );

    while (1) {
        my @changed_files = $watcher->watch();
    }
```

This class monitors a directory of files for changes made to any file matching a regular expression.  It correctly handles new files added to the application as well as files that are deleted.\
 **new ( directory =\> $path** \[, regex =\> `$regex`, delay =\> `$delay ] )` Creates a new Watcher object.\
 **watch** Returns a list of files that have been added, deleted, or changed since the last time watch was called. Catalyst, Catalyst::Engine::HTTP::Restarter, File::Modified Sebastian Riedel, \<sri@cpan.org\> Andy Grundman, \<andy@hybridized.org\> Many parts are ripped out of `"HTTP::Server::Simple"` by Jesse Vincent. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
