From: Dave Rolsky Date: Sat, 23 May 2009 15:26:40 +0000 (+0000) Subject: Update pod for all restarter classes. Remove fork_and_start from Win32 X-Git-Tag: 1.16~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Devel.git;a=commitdiff_plain;h=36ff1319f8ecfab361d9f537f3467baeef888cae Update pod for all restarter classes. Remove fork_and_start from Win32 which was just a copy of the parent's method. --- diff --git a/lib/Catalyst/Restarter.pm b/lib/Catalyst/Restarter.pm index 3e01b66..d95a944 100644 --- a/lib/Catalyst/Restarter.pm +++ b/lib/Catalyst/Restarter.pm @@ -115,7 +115,9 @@ Catalyst::Restarter - Uses File::ChangeNotify to check for changed files and res =head1 SYNOPSIS - my $restarter = Catalyst::Restarter->new( + my $class = Catalyst::Restarter->pick_subclass; + + my $restarter = $class->new( directories => '/path/to/MyApp', regex => '\.yml$|\.yaml$|\.conf|\.pm$', start_sub => sub { ... } @@ -125,15 +127,24 @@ Catalyst::Restarter - Uses File::ChangeNotify to check for changed files and res =head1 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 L to watch one or more directories of files and restart the Catalyst server when any of those files changes. =head1 METHODS +=head2 pick_subclass + +Returns the name of an appropriate subclass for the given platform. + =head2 new ( start_sub => sub { ... }, ... ) -This method creates a new restarter object. +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. diff --git a/lib/Catalyst/Restarter/Forking.pm b/lib/Catalyst/Restarter/Forking.pm index 3c136f4..960a854 100644 --- a/lib/Catalyst/Restarter/Forking.pm +++ b/lib/Catalyst/Restarter/Forking.pm @@ -37,3 +37,29 @@ sub _kill_child { } 1; + +__END__ + +=head1 NAME + +Catalyst::Restarter::Forking - Forks and restarts the child process + +=head1 DESCRIPTION + +This class forks and runs the server in a child process. When it needs +to restart, it kills the child and creates a new one. + +=head1 SEE ALSO + +L, L, + +=head1 AUTHORS + +Catalyst Contributors, see Catalyst.pm + +=head1 COPYRIGHT + +This program is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Catalyst/Restarter/Win32.pm b/lib/Catalyst/Restarter/Win32.pm index 4a7d683..ef39ee4 100644 --- a/lib/Catalyst/Restarter/Win32.pm +++ b/lib/Catalyst/Restarter/Win32.pm @@ -11,16 +11,6 @@ has _child => ( ); -sub run_and_watch { - my $self = shift; - - $self->_fork_and_start; - - return unless $self->_child; - - $self->_restart_on_changes; -} - sub _fork_and_start { my $self = shift; @@ -42,3 +32,32 @@ sub _kill_child { } 1; + +__END__ + +=head1 NAME + +Catalyst::Restarter::Win32 - Uses Proc::Background to manage process restarts + +=head1 DESCRIPTION + +This class uses L, which in turn uses +L. 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. + +=head1 SEE ALSO + +L, L, + +=head1 AUTHORS + +Catalyst Contributors, see Catalyst.pm + +=head1 COPYRIGHT + +This program is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut