$foo->can will return a reference to a sub. All you still have to do is get the fully qualified name for the sub from that coderef.
Sub::Identify should do the trick (though I haven't test it)...
What's more: I think it should be possible to extract both the file name and the line number for the source file.
Update: Oh yes it is possible, using B::svref_2object() just like the "Pure Perl" version of the above module, and you can find how in: Track the filename/line number of an anonymous coderef.