| Catalyst-Devel documentation | Contained in the Catalyst-Devel distribution. |
Catalyst::Restarter::Win32 - Uses Proc::Background to manage process restarts
This class uses Proc::Background, which in turn uses Win32::Process. The new process is run using the same command-line as the original script, but without any restart-based options.
This is a big hack, but using forks just does not work on Windows.
Catalyst::Restarter, Catalyst, <File::ChangeNotify>
Catalyst Contributors, see Catalyst.pm
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Devel documentation | Contained in the Catalyst-Devel distribution. |
package Catalyst::Restarter::Win32; use Moose; use Proc::Background; extends 'Catalyst::Restarter'; has _child => ( is => 'rw', isa => 'Proc::Background', ); sub _fork_and_start { my $self = shift; # This is totally hack-tastic, and is probably much slower, but it # does seem to work. my @command = ( $^X, map("-I$_", @INC), $0, grep { ! /^\-r/ } @{ $self->argv } ); my $child = Proc::Background->new(@command); $self->_child($child); } sub _kill_child { my $self = shift; return unless $self->_child; $self->_child->die; } __PACKAGE__->meta->make_immutable; 1; __END__