laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I agree though that the idea runs against the essence of Perl's general lots-of-rope attitude. And indeed as dragonchild pointed out you can shorten the whole thing to UNIVERSAL::isa($self, __PACKAGE__). But even that is problematic, as some other class may well offer the same methods and signatures as yours and therefor be safe, even though it doesn't inherit from yours. See Class::Interface -- isa() Considered Harmful for a thorough discussion of the subject. Of course, depending on your goals, it may be ok, but the caveats should be noted. Something you may want to look into is UNIVERSAL::can() which checks if a method given by name can be called on an object reference. Makeshifts last the longest. In reply to Re^3: OO-style modifiers for 'sub' ?
by Aristotle
|
|