If the command
cpan -L srezic
is used, then before the list of modules there's some lines of CPAN diagnostics output (loading modules, loading indexes etc.). Unfortunately this diagnostics output goes also to stdout, so the command above cannot be used in pipes or backticks.
It would be nice if the diagnostics would go to stderr. I talked to Andreas and he said, that it should be possible by creating an own $CPAN::Frontend which redefines myprint and mywarn.