What about other namespaces? What about multiple matches? A sub is a little like an inode on a unix filesystem: it may have several names, or none; and several handles, or none.
... and probably XS defined subroutines and AUTOLOADed methods and so and so forth. If I had listed all the caveats it would have taken up more space than the code ;-) This was posted not so much as a solution to the OPs question, rather as a riposte to the bald statement that it couldn't be done.