[Catalyst-commits] r10251 - in Catalyst-Devel/1.00/trunk/lib/Catalyst: . Restarter

autarch at dev.catalyst.perl.org autarch at dev.catalyst.perl.org
Sat May 23 15:26:40 GMT 2009


Author: autarch
Date: 2009-05-23 15:26:40 +0000 (Sat, 23 May 2009)
New Revision: 10251

Modified:
   Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter.pm
   Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Forking.pm
   Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Win32.pm
Log:
Update pod for all restarter classes. Remove fork_and_start from Win32
which was just a copy of the parent's method.

Modified: Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Forking.pm
===================================================================
--- Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Forking.pm	2009-05-23 15:24:44 UTC (rev 10250)
+++ Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Forking.pm	2009-05-23 15:26:40 UTC (rev 10251)
@@ -37,3 +37,29 @@
 }
 
 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<Catalyst::Restarter>, L<Catalyst>, <File::ChangeNotify>
+
+=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

Modified: Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Win32.pm
===================================================================
--- Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Win32.pm	2009-05-23 15:24:44 UTC (rev 10250)
+++ Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter/Win32.pm	2009-05-23 15:26:40 UTC (rev 10251)
@@ -11,16 +11,6 @@
 );
 
 
-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 @@
 }
 
 1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Restarter::Win32 - Uses Proc::Background to manage process restarts
+
+=head1 DESCRIPTION
+
+This class uses L<Proc::Background>, which in turn uses
+L<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.
+
+=head1 SEE ALSO
+
+L<Catalyst::Restarter>, L<Catalyst>, <File::ChangeNotify>
+
+=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

Modified: Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter.pm
===================================================================
--- Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter.pm	2009-05-23 15:24:44 UTC (rev 10250)
+++ Catalyst-Devel/1.00/trunk/lib/Catalyst/Restarter.pm	2009-05-23 15:26:40 UTC (rev 10251)
@@ -115,7 +115,9 @@
 
 =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 @@
 
 =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<File::ChangeNotify> 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.




More information about the Catalyst-commits mailing list