Changing to $code->isa('CODE') in this case would actually break 99% of use cases...
So would changing to fileno $code, but I didn't suggest that either.
I don't really care if the naive approach satisfies 99% of the use cases for two reasons. First, I've had well-used code on the CPAN for years that tends to break in messy ways when people use quick hacks instead of well-tested, working code. Second, plenty of people pick up on bad idioms and use them without realizing where they fail and what they break. This leads to even more people breaking my code. and complaining to me and I just can't fix the problems.
I'd love to see a test case for when eval { defined &$code } fails. I couldn't come up with one. I even tried it with overloaded objects.
In reply to Re^4: on the fly methods
by chromatic
in thread on the fly methods
by Ojosh!ro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |