Learn about the built-in UNIVERSAL package, the ancestor of all other packages.

Perl’s built-in UNIVERSAL package is the ancestor of all other packages—it’s the ultimate parent class in an object-oriented sense. UNIVERSAL provides a few methods for its children to use, inherit, or override.

The VERSION() method

The VERSION() method returns the value of the $VERSION variable of the invoking package or class. If we provide a version number as an optional parameter, the method will throw an exception if the queried $VERSION is not equal to or greater than the parameter.

Given a HowlerMonkey module of version 1.23, its VERSION() method behaves as follows:

Get hands-on with 1200+ tech skills courses.