KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or CLASS->isa(). This means that to find out if something is a reference in the first place and then is reference to this class I have to do eval { $poss->isa("Class") } and check $@ and all that gumph, or else use Scalar::Util 'blessed'; blessed $ref && $ref->isa($class); My question is why? What's wrong with UNIVERSAL::isa called like that? It's much cleaner for things like: my $self = shift if UNIVERSAL::isa($_[0], __PACKAGE__) To see whether this function is being called on the object or not. And is there a nice clean alternative that doesn't get cumbersome with ampersands and potentially long lines?
Tags (comma-separated)
Save Edits
Cancel