---
name: "Catalyst::Restarter"
section: "3pm"
platform: "linux"
package: "libcatalyst-devel-perl"
version: "1.42-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catalyst::Restarter"
---

# Catalyst::Restarter(3pm)

Uses File::ChangeNotify to check for changed files and restart the server

## NAME

Catalyst::Restarter - Uses File::ChangeNotify to check for changed files and restart the server

## SYNOPSIS

```
    my $class = Catalyst::Restarter->pick_subclass;
    my $restarter = $class->new(
        directories => '/path/to/MyApp',
        regex       => '\.yml$|\.yaml$|\.conf|\.pm$',
        start_sub => sub { ... }
    );
    $restarter->run_and_watch;
```

## DESCRIPTION

This is the base class for all restarters, and it also provide functionality for picking an appropriate restarter subclass for a given platform.

This class uses File::ChangeNotify to watch one or more directories of files and restart the Catalyst server when any of those files changes.

## METHODS

### pick\_subclass

Returns the name of an appropriate subclass for the given platform.

### new ( start\_sub =\> sub { ... }, ... )

This method creates a new restarter object, but should be called on a subclass, not this class.

The "start\_sub" argument is required. This is a subroutine reference that can be used to start the Catalyst server.

### run\_and\_watch

This method forks, starts the server in a child process, and then watched for changed files in the parent. When files change, it kills the child, forks again, and starts a new server.

## SEE ALSO

Catalyst, File::ChangeNotify

## AUTHORS

Catalyst Contributors, see Catalyst.pm

## COPYRIGHT

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
