It seems to me that what you're trying to do is figure out whether $code_ref contains something other than a valid code reference. Can't this be done with just if (defined($code_ref) && ref($code_ref) eq 'CODE')? Or do I misunderstand your question?
Yes, you have. Please imagine I'd named that variable $function_name all along and that there was a no strict 'refs'. That is, the error I said I was going to trigger was reasonable for that snippet. That said, if there was some other possible error then the rest of my problem still holds that it's difficult to catch things that happen within a eval {...} without also catching errors from inside that are used within the snippet.