As I understand Perl's fork() corresponds to the OS system call for *nix distros... since there is no equivalent system call on Windows, fork() will not work. The <a href="http://www.xav.com/perl/lib/Pod/perlfork.html">
ActiveState</a> site includes some information on fork() emulation for Windows:<br><br><div style="margin-left: 40px;">The <a href="http://www.xav.com/perl/lib/Pod/perlfunc.html#item_fork"><code>fork()</code></a> emulation is implemented at the level of the Perl interpreter.
What this means in general is that running <a href="http://www.xav.com/perl/lib/Pod/perlfunc.html#item_fork"><code>fork()</code></a> will actually clone the
running interpreter and all its state, and run the cloned interpreter in
a separate thread, beginning execution in the new thread just after the
point where the <a href="http://www.xav.com/perl/lib/Pod/perlfunc.html#item_fork"><code>fork()</code></a> was called in the parent.<br><br></div>I would assume that using this mechanism will incur the memory hit that comes with duplicating the entire Perl interpreter for each call to fork(). You would have to test this to be certain...
<br><br><br>Have you worked with the POE multitasking framework before? I've found that it is a useful (and fun!) alternative when I need a multitasking application on Windows (or ever!). By writing a simple web-server in
<a href="http://search.cpan.org/search?query=poe&mode=all">POE</a> (a truly trivial task) you'd have a multitasking non-blocking application that could listen and delegate appropriately. Check-out the cookbook at the project homepage for some ideas:
<a href="http://poe.perl.org/">http://poe.perl.org/</a><br><br><br>Good Luck!<br>Montgomery<br><br><br><div><span class="gmail_quote">On 2/8/07, <b class="gmail_sendername">Sam Foster</b> <<a href="mailto:austin.pm@sam-i-am.com">
austin.pm@sam-i-am.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">so what is the skinny with fork on windows? No, not ever, yes with some
<br>workarounds, yes with a particular distribution of perl for win32s?<br><br>I'm trying to put a web front-end on a build process - that may take a<br>while. Ideally my initial request would kick off the build, and later
<br>requests would check on its status and finally pick up the output and<br>send it or a link to it back to the client.<br>I'm developing on and will ultimately be deploying to a windows xp box<br>with apache and activestate's perl.
<br><br>So, it would seem that I should fork to kick the process off, send back<br>a "working..." message as a response and close stdout in the parent<br>process.<br>The child process goes on working, putting output from the build script
<br>into a file.<br><br>The client would keep polling every few seconds to check status, and<br>grab and respond with the build script output, which will finally<br>include a link to where the user can download a zip of the output.
<br><br>This is just for internal usage, and wont get high traffic. Concurrent<br>requests are possible, but honestly quite unlikely. In fact, depending<br>on the load on the server, the build usually finishes inside a minute so
<br>I could probably keep it simple and just sit and wait for the response -<br>but I'd like to know what my options are. I do need input (config data)<br>from the user so I cant just schedule this and run it nightly or something.
<br><br>Oh, and this is supposed to be a fun diversion from my real job, so if<br>I'm trying to make it too complicated that's why :)<br>thanks for any thoughts<br>Sam<br><br>_______________________________________________
<br>Austin mailing list<br><a href="mailto:Austin@pm.org">Austin@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/austin">http://mail.pm.org/mailman/listinfo/austin</a><br></blockquote></div><br>