X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbase.pm;h=c6d8cca4a78fad00ee3197c3ba60ddc1dce448b0;hb=6bcc4512882cbfb9a802c28116e3f7a01455c5f8;hp=b8d210e745b2d4fde2e2d8ecd3429ae9002b553f;hpb=4f470f63ec19cae10190b8f3ed622153f261d3b1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/base.pm b/lib/base.pm index b8d210e..c6d8cca 100644 --- a/lib/base.pm +++ b/lib/base.pm @@ -30,7 +30,7 @@ Cs them. Whether to C a base class package is determined by the absence of a global $VERSION in the base package. If $VERSION is not detected even after loading it, will define $VERSION in the base package, setting it to the string -C<-1, defined by base.pm>. +C<-1, set by base.pm>. =head1 HISTORY @@ -44,29 +44,23 @@ L package base; -use 5.005_64; -our $VERSION = "1.01"; +use 5.006_001; +our $VERSION = "1.02"; sub import { my $class = shift; my $fields_base; my $pkg = caller(0); - my @attrs; - my $isa = \@{"$pkg\::ISA"}; - foreach my $base (@_) { - if ($base =~ /^[-+]/) { #attribute - push @attrs, $base; - next; - } next if $pkg->isa($base); - push @$isa, $base; - unless (exists ${"$base\::"}{VERSION}) { + push @{"$pkg\::ISA"}, $base; + my $vglob; + unless (${*{"$base\::VERSION"}{SCALAR}}) { 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 /; + die if $@ && $@ !~ /^Can't locate .*? at \(eval /; unless (%{"$base\::"}) { require Carp; Carp::croak("Base class package \"$base\" is empty.\n", @@ -74,7 +68,7 @@ sub import { "which defines that package first.)"); } ${"$base\::VERSION"} = "-1, set by base.pm" - unless exists ${"$base\::"}{VERSION}; + unless ${*{"$base\::VERSION"}{SCALAR}}; } # A simple test like (defined %{"$base\::FIELDS"}) will @@ -94,10 +88,6 @@ sub import { require fields; fields::inherit($pkg, $fields_base); } - if (@attrs) { - require attributes; - attributes::->import($pkg, $isa, @attrs); - } } 1;