Chapter 16. Special Classes
The special class UNIVERSAL
contains methods that are automatically inherited by all other classes:
- can method
Returns a reference to the method if its invocant has it, undef otherwise.
- isa class
Returns true if its invocant is class, or any class inheriting from class.
- VERSION [ need ]
Returns the version of its invocant. Checks the version if need is supplied.
These methods can be used as normal functions as well, e.g., UNIVERSAL::isa($c,Math::Complex::)
.
The pseudopackage CORE
provides access to all Perl built-in functions, even when they have been overridden.
The pseudopackage SUPER
provides access to base class methods without having to specify which class defined that method. This is meaningful only when used inside a method.
Get Perl Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.