Somewhere in my collection of unfinished Perl code, is a script that does something similar. My approach was to download http://www.cpan.org/modules/01modules.index.html, then use
HTML::Parser to extract the good stuff. As I recall, some "creative" parsing of the module names is required because the formats vary slightly. Comparing the versions from the list to the versions installed is also challenging, as different authors use different approaches to version bumping.