in reply to Re^2: WWW::Mechanize timeout problem
in thread WWW::Mechanize timeout problem

For Windows, the simplest solution is a parent monitor process that kills the child worker after a timeout. See Proc::Background. You can even write it in a generic way that adds timeouts to any script you might launch through it. By the way, SIGALRM doesn't actually exist on Windows; it'll be a perl emulation which might not behave the same way. I actually don't know if I've tried it on Windows before. Hopefully LWP::UserAgent is written with select() rather than SIGALARM, but I don't know that either.

You could also try an event library like Mojo::IOLoop or AnyEvent or IO::Async with a matching event-based user agent like Mojo::UserAgent, AnyEvent::UserAgent, or Net::Async::HTTP. These involve re-writing your script significantly, but then you have all the benefits of event-driven programming at your fingertips, and a timeout is super-easy.