NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Params::Util and UNIVERSAL::can (Score:1)
Params::Util::_INSTANCE has long done Scalar::Util::blessed($foo) and $foo->isa('bar'), I'd be interested to see how much overhead the extra function call adds.
Also, try substituting UNIVERSAL::can($foo, 'can') for blessed($foo)
Re:Params::Util and UNIVERSAL::can (Score:2)
So you want a fully qualified call to blessed instead of my importing it? Or did you miss that I had called blessed? UNIVERSAL::can('isa') is interestesting, but I'm sure that won't be much faster. I've added both of those (the fully qualified Scalar::Util::blessed() is called 'fqblessed', of course).
So for my special case use, I can use UNIVERSAL::can and simply declare the class final (but it's an internal class, so that's OK). Otherwise, blessed plus isa is the fastest and most correct out of the alternatives I've tried.
Reply to This
Parent
Re: (Score:1)