Class::Load::XS#

📦 std

The compiled is_class_loaded of Class::Load: whether a package has been loaded, judged from its symbol table.

A package counts as loaded when it has a $VERSION (a version object, a reference to a defined value, or any defined value), a non-empty @ISA, or at least one sub, constant or stub. With { -version => $v } it counts only when $class->VERSION($v) does not die. Class::Load calls this in place of its pure-Perl version; it is not normally called directly.

This is a native implementation of Class::Load::XS 0.10’s XS.xs; its Class/Load/XS.pm is used unchanged, and Class::Load itself comes from CPAN.

Synopsis#

use Class::Load qw(is_class_loaded);   # takes this one when it can

print is_class_loaded('Some::Class') ? "loaded\n" : "not loaded\n";
print is_class_loaded('Some::Class', { -version => '1.2' }) ? "1.2 or later\n" : "older, or not loaded\n";

Differences from upstream#

None.

Functions#

Class::Load#

is_class_loaded#

Whether a package is loaded: it has a $VERSION, a non-empty @ISA or a sub; with { -version => $v }, whether $class->VERSION($v) succeeds.