I suggest you have a poke around the insides of mirror. It should be a relatively simple job to adapt part of it to list rather than retrieve files.
I've just had a quick look, and i think lsparse.pl will answer a lot of questions. i was startled to find that it isn't even using strict, but it's very readable.