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:
>   http://www.cpantesters.org/cpan/report/6c50e2a4-6c0f-1014-988b-f0c2162c787f
>
> 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:
>   
> https://github.com/DrHyde/perl-modules-CPAN-ParseDistribution/blob/master/lib/CPAN/ParseDistribution.pm#L186
>
> 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:

https://github.com/dagolden/cpan-reporter/blob/master/lib/CPAN/Reporter.pm#L1269

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...

Cheers,
-Jan

Reply via email to