Integrate with Sarathy.
[p5sagit/p5-mst-13.2.git] / lib / base.pm
index 9a733ea..3cb42f5 100644 (file)
@@ -43,20 +43,24 @@ L<fields>
 =cut
 
 package base;
-use vars qw($VERSION);
-$VERSION = "1.00";
+
+use 5.005_64;
+our $VERSION = "1.01";
 
 sub import {
     my $class = shift;
     my $fields_base;
+    my $pkg = caller(0);
 
     foreach my $base (@_) {
+       next if $pkg->isa($base);
+       push @{"$pkg\::ISA"}, $base;
        unless (exists ${"$base\::"}{VERSION}) {
            eval "require $base";
            # Only ignore "Can't locate" errors from our eval require.
            # Other fatal errors (syntax etc) must be reported.
            die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
-           unless (defined %{"$base\::"}) {
+           unless (%{"$base\::"}) {
                require Carp;
                Carp::croak("Base class package \"$base\" is empty.\n",
                            "\t(Perhaps you need to 'use' the module ",
@@ -79,8 +83,6 @@ sub import {
            }
        }
     }
-    my $pkg = caller(0);
-    push @{"$pkg\::ISA"}, @_;
     if ($fields_base) {
        require fields;
        fields::inherit($pkg, $fields_base);