sub _mk_column_accessors { my $class = shift; my @new = grep {!exists &{$class."::$_"}} @_; # remember new ones $class->SUPER::_mk_column_accessors( @_ ); # accessors + mutators # Redefine accessors to be very lean no warnings 'redefine'; no strict 'refs'; foreach (@new) { my $method = $class."::$_"; my $old = \&$method; *$method = sub { # if not available yet, got fetch with normal accessor return $old->( @_ ) unless exists $_[0]->{$_}; $_[0]->{$_}; }; } } #_mk_column_accessors