Yuval Kogman wrote:
BTW, pure perl blessed() will work:
sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) }
sub blessed ($) {
local($@, $SIG{__DIE__}, $SIG{__WARN__});
length(ref($_[0]))
? eval { $_[0]->a_sub_not_likely_to_be_here }
: undef
}
<http://search.cpan.org/src/GBARR/Scalar-List-Utils-1.19/lib/Scalar/Util.pm>
I predict that the next anti duck perl idiom is going to be:
eval { $x->UNIVERSAL::can("can") }
to determine "true blessedness"
Actually, isn't UNIVERSAL::can($x, 'can') still valid? I seem to
remember that at one point it was considered the only valid use of
UNVERSAL::can directly.
Adam K