in reply to killing a process after some time

There's some code in CPAN::FindDependencies::MakeMaker that does pretty much exactly what you want, apart from the repetition bit - but that should be easy to add. Look in the get_reqs_from_mm function.