foreach my $base (@_) {
next if $pkg->isa($base);
push @{"$pkg\::ISA"}, $base;
- unless (exists ${"$base\::"}{VERSION}) {
+ my $vglob;
+ unless ($vglob = ${"$base\::"}{VERSION} and $vglob{SCALAR}) {
eval "require $base";
# Only ignore "Can't locate" errors from our eval require.
# Other fatal errors (syntax etc) must be reported.
"which defines that package first.)");
}
${"$base\::VERSION"} = "-1, set by base.pm"
- unless exists ${"$base\::"}{VERSION};
+ unless $vglob = ${"$base\::"}{VERSION} and $vglob{SCALAR};
}
# A simple test like (defined %{"$base\::FIELDS"}) will
'Foo::Bar::Baz' => 'b1:1,b2:2,b3:3,foo:4,bar:5,baz:6',
);
-print "1..", int(keys %expect)+13, "\n";
+print "1..", int(keys %expect)+14, "\n";
my $testno = 0;
while (my($class, $exp) = each %expect) {
no strict 'refs';
print $a->{foo}[1], "\n";
print $a->{bar}->{A}, "\n";
}
+
+
+# Test $VERSION bug
+package No::Version;
+
+use vars qw($Foo);
+sub VERSION { 42 }
+
+package Test::Version;
+
+use base qw(No::Version);
+print "not " unless $No::Version::VERSION =~ /set by base\.pm/;
+print "ok ", ++$testno ,"\n";