Align ro/wo makers with documentation
[p5sagit/Class-Accessor-Grouped.git] / lib / Class / Accessor / Grouped.pm
index 24b6971..46900db 100644 (file)
@@ -178,6 +178,7 @@ sub mk_group_ro_accessors {
   my($self, $group, @fields) = @_;
 
   $self->_mk_group_accessors('make_group_ro_accessor', $group, @fields);
+  return;
 }
 
 =head2 mk_group_wo_accessors
@@ -202,6 +203,7 @@ sub mk_group_wo_accessors {
   my($self, $group, @fields) = @_;
 
   $self->_mk_group_accessors('make_group_wo_accessor', $group, @fields);
+  return;
 }
 
 =head2 get_simple
@@ -282,16 +284,8 @@ sub get_inherited {
   my $cag_slot = '::__cag_'. $_[1];
   return ${$class.$cag_slot} if defined(${$class.$cag_slot});
 
-  # we need to be smarter about recalculation, as @ISA (thus supers) can very well change in-flight
-  my $cur_gen = mro::get_pkg_gen ($class);
-  if ( $cur_gen != ${$class.'::__cag_pkg_gen__'} ) {
-    @{$class.'::__cag_supers__'} = $_[0]->get_super_paths;
-    ${$class.'::__cag_pkg_gen__'} = $cur_gen;
-  }
-
-  for (@{$class.'::__cag_supers__'}) {
-    return ${$_.$cag_slot} if defined(${$_.$cag_slot});
-  };
+  do { return ${$_.$cag_slot} if defined(${$_.$cag_slot}) }
+    for $_[0]->get_super_paths;
 
   return undef;
 }
@@ -413,7 +407,10 @@ inherited from. This is what drives the traversal done by L</get_inherited>.
 =cut
 
 sub get_super_paths {
-  return @{mro::get_linear_isa( ref($_[0]) || $_[0] )};
+  # get_linear_isa returns the class itself as the 1st element
+  # use @_ as a pre-allocated scratch array
+  (undef, @_) = @{mro::get_linear_isa( length( ref($_[0]) ) ? ref($_[0]) : $_[0] )};
+  @_;
 };
 
 =head2 make_group_accessor