in reply to Reconfiguration of classes in an "inheritable" manner
Maybe not reading it right, but I'd think you could just stash the config values in a class variable (so %my::base::_config or %my::branch_A::_config). You'd need something to walk up the @ISA to retrieve values if they're not present in the class of the instance (handwaving here and untested ):
sub _fetch { my( $class, $key ) = @_; no strict q{refs}; my $opts = \%{ ref($class) . q{::_config} }; if( exists $opts->{ $key } ) { return $opts->{ $key }; } else { return SUPER->_fetch( $key ); } } sub configure { my( $class, %opts ) = @_; no strict q{refs}; my $opts = \%{ $class . q{::_config} }; for my ($k, $v) ( each %opts ) { $opts->{ $k } = $v; } return; }
Edit: Adding stub configure
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|