Revision history for Perl extension Class-MOP.
* Class::MOP
+ - Made is_class_loaded a little stricter. It was reporting that
+ a class was loaded if it merely had an @ISA variable in its
+ stash. Now it checks that the @ISA var has elements in it.
+ * Class::MOP
- Deprecate in_global_destruction and subname re-exporting
(perigrin & Sartak)
* Class::MOP::Class
use strict;
use warnings;
-use Test::More tests => 34;
+use Test::More tests => 36;
use Test::Exception;
require Class::MOP;
ok( Class::MOP::is_class_loaded('TestClassLoaded3'),
'We see that TestClassLoaded3 is loaded after requiring it (it has an @ISA but no methods or $VERSION)' );
}
+
+{
+ {
+ package Not::Loaded;
+ our @ISA;
+ }
+
+ ok( ! Class::MOP::is_class_loaded('Not::Loaded'),
+ 'the mere existence of an @ISA for a package does not mean a class is loaded' );
+}
+
+{
+ {
+ package Loaded::Ish;
+ our @ISA = 'Foo';
+ }
+
+ ok( Class::MOP::is_class_loaded('Loaded::Ish'),
+ 'an @ISA with members does mean a class is loaded' );
+}
+
if (hv_exists_ent (stash, KEY_FOR(ISA), HASH_FOR(ISA))) {
HE *isa = hv_fetch_ent(stash, KEY_FOR(ISA), 0, HASH_FOR(ISA));
- if (isa && HeVAL(isa) && GvAV(HeVAL(isa))) {
+ if (isa && HeVAL(isa) && GvAV(HeVAL(isa)) && av_len(GvAV(HeVAL(isa))) != -1) {
XSRETURN_YES;
}
}