From: Rick Delaney Date: Mon, 10 Sep 2007 10:45:41 +0000 (-0400) Subject: Re: mro "PERFORMANCE CONSIDERATIONS" still true? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6df974e5cec9080f83fec3cb22f1c756d1aa4628;p=p5sagit%2Fp5-mst-13.2.git Re: mro "PERFORMANCE CONSIDERATIONS" still true? Message-ID: <20070910144541.GI9260@bort.ca> plus update Changes file for base.pm p4raw-id: //depot/perl@31851 --- diff --git a/lib/base.pm b/lib/base.pm index 76e235d..9649e8a 100644 --- a/lib/base.pm +++ b/lib/base.pm @@ -2,7 +2,7 @@ package base; use strict 'vars'; use vars qw($VERSION); -$VERSION = '2.12'; +$VERSION = '2.13'; # constant.pm is slow sub SUCCESS () { 1 } @@ -69,6 +69,7 @@ sub import { my $fields_base; my $inheritor = caller(0); + my @isa_classes; foreach my $base (@_) { if ( $inheritor eq $base ) { @@ -103,7 +104,7 @@ ERROR ${$base.'::VERSION'} = "-1, set by base.pm" unless defined ${$base.'::VERSION'}; } - push @{"$inheritor\::ISA"}, $base; + push @isa_classes, $base; if ( has_fields($base) || has_attr($base) ) { # No multiple fields inheritance *suck* @@ -115,6 +116,8 @@ ERROR } } } + # Save this until the end so it's all or nothing if the above loop croaks. + push @{"$inheritor\::ISA"}, @isa_classes; if( defined $fields_base ) { inherit_fields($inheritor, $fields_base); diff --git a/lib/base/Changes b/lib/base/Changes index b86a7bd..7b1f611 100644 --- a/lib/base/Changes +++ b/lib/base/Changes @@ -1,3 +1,6 @@ +2.13 + - push all classes at once in @ISA + 2.12 Fri Jul 6 00:57:15 PDT 2007 Test Features - Test that base.pm preserves $VERSION after real module loading.