in reply to How do I test the validity of a CODE reference?

You can't tell if a code ref actually has code behind it that way. \&anyNameHere will return an apparently valid code ref. The only way is to actually invoke it, so do the invocation within an eval block:

print $_, ':', eval{ $_->(); 1 } ? "S'ok" : "Uht erd!" for sub{ print 'good code' }, \&doesNotExist;; good code CODE(0x194a9b4) : S'ok CODE(0x194a954) : Uht erd!

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."