in reply to Re^5: How do I test the validity of a CODE reference?
in thread How do I test the validity of a CODE reference?
Yes - when you descend to that level they become very similar, indeed :-)
At a high level:
| validate $x | defined &$x | ref $x && defined &$x | |
|---|---|---|---|
| code ref | returns result | returns result | returns result |
| sub name | dies | returns result | returns false |
| other refs | dies | dies | dies |
| undefined | ? | stringified | returns false |
I couldn't even get correct results on perl-5.6.2 with CvROOT and CvXSUB
That's odd, because defined and sub calls use CvROOT(cv) || CvXSUB(cv) in 5.6.2 as well.
|
|---|