On Tue, May 28, 2013 at 7:53 AM, David Cantrell <da...@cantrell.org.uk> wrote:
> I've got a wee problem with one of my modules on Windows:
> However, I don't have a Windows licence, nor do I know how to drive
> Windows, nor, to be blunt, do I particularly want to learn. But if
> anyone could help me make my code more portable I'd be very grateful.
> The code in my module that has the problem starts at line 186 here:
> Its purpose is to run arbitrary code in a Safe.pm compartment, and to
> have that compartment time out if it takes more than 5 seconds. It does
> this using Parallel::ForkManager to run the Safe compartment in a child
> process. The child may return data to the parent via some magic in
> Parallel::ForkManager which is effectively a wrapper around Storable.
> Stuff that assumes a Unixy world, other than fork()ing in the first
> place, is the kill() on line 194.
> I presume that the 17-ish lines starting at 186 will need to be
> completely different for Windows.
> If anyone can help, the beers are on me at the next YAPC we're both at!
Sorry, no time to help, but if you find somebody with the time, then
CPAN::Reporter may have some code you can borrow:
Unfortunately you won't be able to use fork(); you'll have to create a
new process inside a "Job", where the Job can have a timeout...