[Catalyst] New restarter code in Catalyst::Devel 1.14_01

Rodrigo rodrigolive at gmail.com
Tue May 19 07:06:04 GMT 2009


> I did test this on WinXP using Strawberry (5.8.8, IIRC), and it worked
> fine. Win32 Perl does support a fork emulation that uses thread under the
> hood.
>

Strange. I'll try it with a different/older version of Strawberry Perl and
see what happens.


>
> I don't think the fork implementation in Strawberry is any different than
> ActivePerl. ActiveState wrote the fork implementation (again, IIRC) and
> contributed it to the Perl core.
>

Their forks seem to behave slightly different (it's a feeling more than a
fact), even though I agree that the code is probably the same one Microsoft
helped develop originally. The compilers are different though, VisualStudio
vs MinGW.


>
> That said, I was thinking it might be good to also have a threads-based
> version available, and that could be the default to use on Win32.
>
> I took a stab at doing this at one point, but got stuck on trying to
> actually kill the "child" thread.
>

Since I needed to have the restarter working badly on that machine in
particular, I quickly patched the code with Proc::Background. Something like
this:

sub _fork_and_start() {
   my $proc =3D new Proc::Background("perl $0");  # I'm writing this from
memory; not this exactly, there were more args...
   my $pid =3D $proc->pid;
...}

It did the job since the background process was a non-restarter dev server.
And the restarter was able to kill it just fine when changes were detected
because $pid is a real os pid.

I think I put threads / async { } somewhere in there before using
Proc::Background but I got an error... and don't recall which. Killing the
thread requires it to die from the inside, sending it a signal of some sort.


Couldn't the restarter be subclassed then changed in myapp_script.pl through
an %ENV variable?

-rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090519/44182=
690/attachment.htm


More information about the Catalyst mailing list