has delay => (is => 'rw');
has regex => (is => 'rw');
-has modified => (is => 'rw');
+has modified => (is => 'rw', builder => '_build_modified', lazy => 1);
has directory => (is => 'rw');
-has watch_list => (is => 'rw');
+has watch_list => (is => 'rw', builder => '_build_watch_list', lazy => 1);
has follow_symlinks => (is => 'rw');
-sub BUILD {
- shift->_init;
+sub _build_watch_list {
+ my ($self) = @_;
+ return $self->_index_directory;
}
-sub _init {
- my $self = shift;
-
- my $watch_list = $self->_index_directory;
- $self->watch_list($watch_list);
-
- $self->modified(
- File::Modified->new(
- method => 'mtime',
- files => [ keys %{$watch_list} ],
- )
+sub _build_modified {
+ my ($self) = @_;
+ return File::Modified->new(
+ method => 'mtime',
+ files => [ keys %{ $self->watch_list } ],
);
}
my $is_immutable = $meta->can('is_immutable');
my $make_mutable = $meta->can('make_mutable');
$meta->$make_mutable() if $is_immutable && $make_mutable && $meta->$is_immutable();
+ eval { # Do not explode the watcher process if this fails.
+ my $superclasses = $meta->can('superclasses');
+ $meta->$superclasses('Moose::Object') if $superclasses;
+ };
}
});
}
+ local $Catalyst::__AM_RESTARTING = 1; # Hack to avoid C3 fail
delete $INC{$file}; # Remove from %INC so it will reload
local $SIG{__WARN__} = sub { };